From 2ea71d5e5a840b9f8f6b4f934f195b2cdd626e9b Mon Sep 17 00:00:00 2001 From: Travis Prescott Date: Tue, 31 Aug 2021 15:11:56 -0700 Subject: [PATCH 1/4] Regenerate index code. --- .../indexes/_generated/models/_models.py | 53 +++++++++--------- .../indexes/_generated/models/_models_py3.py | 54 ++++++++++--------- 2 files changed, 55 insertions(+), 52 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models.py index d0826880b941..158157428cc7 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models.py @@ -62,37 +62,36 @@ class AnalyzeRequest(msrest.serialization.Model): :param text: Required. The text to break into tokens. :type text: str - :param analyzer: The name of the analyzer to use to break the given text. If this parameter is - not specified, you must specify a tokenizer instead. The tokenizer and analyzer parameters are - mutually exclusive. Possible values include: "ar.microsoft", "ar.lucene", "hy.lucene", - "bn.microsoft", "eu.lucene", "bg.microsoft", "bg.lucene", "ca.microsoft", "ca.lucene", - "zh-Hans.microsoft", "zh-Hans.lucene", "zh-Hant.microsoft", "zh-Hant.lucene", "hr.microsoft", - "cs.microsoft", "cs.lucene", "da.microsoft", "da.lucene", "nl.microsoft", "nl.lucene", - "en.microsoft", "en.lucene", "et.microsoft", "fi.microsoft", "fi.lucene", "fr.microsoft", - "fr.lucene", "gl.lucene", "de.microsoft", "de.lucene", "el.microsoft", "el.lucene", - "gu.microsoft", "he.microsoft", "hi.microsoft", "hi.lucene", "hu.microsoft", "hu.lucene", - "is.microsoft", "id.microsoft", "id.lucene", "ga.lucene", "it.microsoft", "it.lucene", - "ja.microsoft", "ja.lucene", "kn.microsoft", "ko.microsoft", "ko.lucene", "lv.microsoft", - "lv.lucene", "lt.microsoft", "ml.microsoft", "ms.microsoft", "mr.microsoft", "nb.microsoft", - "no.lucene", "fa.lucene", "pl.microsoft", "pl.lucene", "pt-BR.microsoft", "pt-BR.lucene", - "pt-PT.microsoft", "pt-PT.lucene", "pa.microsoft", "ro.microsoft", "ro.lucene", "ru.microsoft", - "ru.lucene", "sr-cyrillic.microsoft", "sr-latin.microsoft", "sk.microsoft", "sl.microsoft", - "es.microsoft", "es.lucene", "sv.microsoft", "sv.lucene", "ta.microsoft", "te.microsoft", - "th.microsoft", "th.lucene", "tr.microsoft", "tr.lucene", "uk.microsoft", "ur.microsoft", - "vi.microsoft", "standard.lucene", "standardasciifolding.lucene", "keyword", "pattern", - "simple", "stop", "whitespace". + :param analyzer: The name of the analyzer to use to break the given text. Possible values + include: "ar.microsoft", "ar.lucene", "hy.lucene", "bn.microsoft", "eu.lucene", "bg.microsoft", + "bg.lucene", "ca.microsoft", "ca.lucene", "zh-Hans.microsoft", "zh-Hans.lucene", + "zh-Hant.microsoft", "zh-Hant.lucene", "hr.microsoft", "cs.microsoft", "cs.lucene", + "da.microsoft", "da.lucene", "nl.microsoft", "nl.lucene", "en.microsoft", "en.lucene", + "et.microsoft", "fi.microsoft", "fi.lucene", "fr.microsoft", "fr.lucene", "gl.lucene", + "de.microsoft", "de.lucene", "el.microsoft", "el.lucene", "gu.microsoft", "he.microsoft", + "hi.microsoft", "hi.lucene", "hu.microsoft", "hu.lucene", "is.microsoft", "id.microsoft", + "id.lucene", "ga.lucene", "it.microsoft", "it.lucene", "ja.microsoft", "ja.lucene", + "kn.microsoft", "ko.microsoft", "ko.lucene", "lv.microsoft", "lv.lucene", "lt.microsoft", + "ml.microsoft", "ms.microsoft", "mr.microsoft", "nb.microsoft", "no.lucene", "fa.lucene", + "pl.microsoft", "pl.lucene", "pt-BR.microsoft", "pt-BR.lucene", "pt-PT.microsoft", + "pt-PT.lucene", "pa.microsoft", "ro.microsoft", "ro.lucene", "ru.microsoft", "ru.lucene", + "sr-cyrillic.microsoft", "sr-latin.microsoft", "sk.microsoft", "sl.microsoft", "es.microsoft", + "es.lucene", "sv.microsoft", "sv.lucene", "ta.microsoft", "te.microsoft", "th.microsoft", + "th.lucene", "tr.microsoft", "tr.lucene", "uk.microsoft", "ur.microsoft", "vi.microsoft", + "standard.lucene", "standardasciifolding.lucene", "keyword", "pattern", "simple", "stop", + "whitespace". :type analyzer: str or ~azure.search.documents.indexes.models.LexicalAnalyzerName - :param tokenizer: The name of the tokenizer to use to break the given text. If this parameter - is not specified, you must specify an analyzer instead. The tokenizer and analyzer parameters - are mutually exclusive. Possible values include: "classic", "edgeNGram", "keyword_v2", - "letter", "lowercase", "microsoft_language_tokenizer", "microsoft_language_stemming_tokenizer", - "nGram", "path_hierarchy_v2", "pattern", "standard_v2", "uax_url_email", "whitespace". + :param tokenizer: The name of the tokenizer to use to break the given text. Possible values + include: "classic", "edgeNGram", "keyword_v2", "letter", "lowercase", + "microsoft_language_tokenizer", "microsoft_language_stemming_tokenizer", "nGram", + "path_hierarchy_v2", "pattern", "standard_v2", "uax_url_email", "whitespace". :type tokenizer: str or ~azure.search.documents.indexes.models.LexicalTokenizerName + :param normalizer: The name of the normalizer to use to normalize the given text. Possible + values include: "asciifolding", "elision", "lowercase", "standard", "uppercase". + :type normalizer: str or ~azure.search.documents.indexes.models.LexicalNormalizerName :param token_filters: An optional list of token filters to use when breaking the given text. - This parameter can only be set when using the tokenizer parameter. :type token_filters: list[str or ~azure.search.documents.indexes.models.TokenFilterName] :param char_filters: An optional list of character filters to use when breaking the given text. - This parameter can only be set when using the tokenizer parameter. :type char_filters: list[str or ~azure.search.documents.indexes.models.CharFilterName] """ @@ -104,6 +103,7 @@ class AnalyzeRequest(msrest.serialization.Model): 'text': {'key': 'text', 'type': 'str'}, 'analyzer': {'key': 'analyzer', 'type': 'str'}, 'tokenizer': {'key': 'tokenizer', 'type': 'str'}, + 'normalizer': {'key': 'normalizer', 'type': 'str'}, 'token_filters': {'key': 'tokenFilters', 'type': '[str]'}, 'char_filters': {'key': 'charFilters', 'type': '[str]'}, } @@ -116,6 +116,7 @@ def __init__( self.text = kwargs['text'] self.analyzer = kwargs.get('analyzer', None) self.tokenizer = kwargs.get('tokenizer', None) + self.normalizer = kwargs.get('normalizer', None) self.token_filters = kwargs.get('token_filters', None) self.char_filters = kwargs.get('char_filters', None) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models_py3.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models_py3.py index 2059a140c172..ec9c9d4f72ac 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models_py3.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_generated/models/_models_py3.py @@ -67,37 +67,36 @@ class AnalyzeRequest(msrest.serialization.Model): :param text: Required. The text to break into tokens. :type text: str - :param analyzer: The name of the analyzer to use to break the given text. If this parameter is - not specified, you must specify a tokenizer instead. The tokenizer and analyzer parameters are - mutually exclusive. Possible values include: "ar.microsoft", "ar.lucene", "hy.lucene", - "bn.microsoft", "eu.lucene", "bg.microsoft", "bg.lucene", "ca.microsoft", "ca.lucene", - "zh-Hans.microsoft", "zh-Hans.lucene", "zh-Hant.microsoft", "zh-Hant.lucene", "hr.microsoft", - "cs.microsoft", "cs.lucene", "da.microsoft", "da.lucene", "nl.microsoft", "nl.lucene", - "en.microsoft", "en.lucene", "et.microsoft", "fi.microsoft", "fi.lucene", "fr.microsoft", - "fr.lucene", "gl.lucene", "de.microsoft", "de.lucene", "el.microsoft", "el.lucene", - "gu.microsoft", "he.microsoft", "hi.microsoft", "hi.lucene", "hu.microsoft", "hu.lucene", - "is.microsoft", "id.microsoft", "id.lucene", "ga.lucene", "it.microsoft", "it.lucene", - "ja.microsoft", "ja.lucene", "kn.microsoft", "ko.microsoft", "ko.lucene", "lv.microsoft", - "lv.lucene", "lt.microsoft", "ml.microsoft", "ms.microsoft", "mr.microsoft", "nb.microsoft", - "no.lucene", "fa.lucene", "pl.microsoft", "pl.lucene", "pt-BR.microsoft", "pt-BR.lucene", - "pt-PT.microsoft", "pt-PT.lucene", "pa.microsoft", "ro.microsoft", "ro.lucene", "ru.microsoft", - "ru.lucene", "sr-cyrillic.microsoft", "sr-latin.microsoft", "sk.microsoft", "sl.microsoft", - "es.microsoft", "es.lucene", "sv.microsoft", "sv.lucene", "ta.microsoft", "te.microsoft", - "th.microsoft", "th.lucene", "tr.microsoft", "tr.lucene", "uk.microsoft", "ur.microsoft", - "vi.microsoft", "standard.lucene", "standardasciifolding.lucene", "keyword", "pattern", - "simple", "stop", "whitespace". + :param analyzer: The name of the analyzer to use to break the given text. Possible values + include: "ar.microsoft", "ar.lucene", "hy.lucene", "bn.microsoft", "eu.lucene", "bg.microsoft", + "bg.lucene", "ca.microsoft", "ca.lucene", "zh-Hans.microsoft", "zh-Hans.lucene", + "zh-Hant.microsoft", "zh-Hant.lucene", "hr.microsoft", "cs.microsoft", "cs.lucene", + "da.microsoft", "da.lucene", "nl.microsoft", "nl.lucene", "en.microsoft", "en.lucene", + "et.microsoft", "fi.microsoft", "fi.lucene", "fr.microsoft", "fr.lucene", "gl.lucene", + "de.microsoft", "de.lucene", "el.microsoft", "el.lucene", "gu.microsoft", "he.microsoft", + "hi.microsoft", "hi.lucene", "hu.microsoft", "hu.lucene", "is.microsoft", "id.microsoft", + "id.lucene", "ga.lucene", "it.microsoft", "it.lucene", "ja.microsoft", "ja.lucene", + "kn.microsoft", "ko.microsoft", "ko.lucene", "lv.microsoft", "lv.lucene", "lt.microsoft", + "ml.microsoft", "ms.microsoft", "mr.microsoft", "nb.microsoft", "no.lucene", "fa.lucene", + "pl.microsoft", "pl.lucene", "pt-BR.microsoft", "pt-BR.lucene", "pt-PT.microsoft", + "pt-PT.lucene", "pa.microsoft", "ro.microsoft", "ro.lucene", "ru.microsoft", "ru.lucene", + "sr-cyrillic.microsoft", "sr-latin.microsoft", "sk.microsoft", "sl.microsoft", "es.microsoft", + "es.lucene", "sv.microsoft", "sv.lucene", "ta.microsoft", "te.microsoft", "th.microsoft", + "th.lucene", "tr.microsoft", "tr.lucene", "uk.microsoft", "ur.microsoft", "vi.microsoft", + "standard.lucene", "standardasciifolding.lucene", "keyword", "pattern", "simple", "stop", + "whitespace". :type analyzer: str or ~azure.search.documents.indexes.models.LexicalAnalyzerName - :param tokenizer: The name of the tokenizer to use to break the given text. If this parameter - is not specified, you must specify an analyzer instead. The tokenizer and analyzer parameters - are mutually exclusive. Possible values include: "classic", "edgeNGram", "keyword_v2", - "letter", "lowercase", "microsoft_language_tokenizer", "microsoft_language_stemming_tokenizer", - "nGram", "path_hierarchy_v2", "pattern", "standard_v2", "uax_url_email", "whitespace". + :param tokenizer: The name of the tokenizer to use to break the given text. Possible values + include: "classic", "edgeNGram", "keyword_v2", "letter", "lowercase", + "microsoft_language_tokenizer", "microsoft_language_stemming_tokenizer", "nGram", + "path_hierarchy_v2", "pattern", "standard_v2", "uax_url_email", "whitespace". :type tokenizer: str or ~azure.search.documents.indexes.models.LexicalTokenizerName + :param normalizer: The name of the normalizer to use to normalize the given text. Possible + values include: "asciifolding", "elision", "lowercase", "standard", "uppercase". + :type normalizer: str or ~azure.search.documents.indexes.models.LexicalNormalizerName :param token_filters: An optional list of token filters to use when breaking the given text. - This parameter can only be set when using the tokenizer parameter. :type token_filters: list[str or ~azure.search.documents.indexes.models.TokenFilterName] :param char_filters: An optional list of character filters to use when breaking the given text. - This parameter can only be set when using the tokenizer parameter. :type char_filters: list[str or ~azure.search.documents.indexes.models.CharFilterName] """ @@ -109,6 +108,7 @@ class AnalyzeRequest(msrest.serialization.Model): 'text': {'key': 'text', 'type': 'str'}, 'analyzer': {'key': 'analyzer', 'type': 'str'}, 'tokenizer': {'key': 'tokenizer', 'type': 'str'}, + 'normalizer': {'key': 'normalizer', 'type': 'str'}, 'token_filters': {'key': 'tokenFilters', 'type': '[str]'}, 'char_filters': {'key': 'charFilters', 'type': '[str]'}, } @@ -119,6 +119,7 @@ def __init__( text: str, analyzer: Optional[Union[str, "LexicalAnalyzerName"]] = None, tokenizer: Optional[Union[str, "LexicalTokenizerName"]] = None, + normalizer: Optional[Union[str, "LexicalNormalizerName"]] = None, token_filters: Optional[List[Union[str, "TokenFilterName"]]] = None, char_filters: Optional[List[Union[str, "CharFilterName"]]] = None, **kwargs @@ -127,6 +128,7 @@ def __init__( self.text = text self.analyzer = analyzer self.tokenizer = tokenizer + self.normalizer = normalizer self.token_filters = token_filters self.char_filters = char_filters From 7e7027c8ac2a9657131f11d8eb3826460a7a19b2 Mon Sep 17 00:00:00 2001 From: Travis Prescott Date: Tue, 31 Aug 2021 15:12:09 -0700 Subject: [PATCH 2/4] Regenerate service code. --- .../search/documents/_generated/__init__.py | 4 +- .../documents/_generated/_configuration.py | 36 +- .../documents/_generated/_search_client.py | 25 +- .../documents/_generated/aio/__init__.py | 3 +- .../_generated/aio/_configuration.py | 47 +- .../_generated/aio/_search_client.py | 40 +- .../_generated/aio/operations/__init__.py | 2 +- .../aio/operations/_documents_operations.py | 674 ++++++------------ .../documents/_generated/models/__init__.py | 60 +- .../documents/_generated/models/_models.py | 629 ++++++++-------- .../_generated/models/_models_py3.py | 410 ++++++----- .../_generated/models/_search_client_enums.py | 18 +- .../_generated/operations/__init__.py | 2 +- .../operations/_documents_operations.py | 634 +++++----------- 14 files changed, 1060 insertions(+), 1524 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/__init__.py index ded7334f9801..d58f5fc3b7f8 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/__init__.py @@ -7,12 +7,10 @@ # -------------------------------------------------------------------------- from ._search_client import SearchClient - -__all__ = ["SearchClient"] +__all__ = ['SearchClient'] try: from ._patch import patch_sdk # type: ignore - patch_sdk() except ImportError: pass diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/_configuration.py index bc46ba7d2a8a..c6e1f319faca 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/_configuration.py @@ -17,7 +17,6 @@ VERSION = "unknown" - class SearchClientConfiguration(Configuration): """Configuration for SearchClient. @@ -46,31 +45,20 @@ def __init__( self.endpoint = endpoint self.index_name = index_name self.api_version = "2021-04-30-Preview" - kwargs.setdefault("sdk_moniker", "search-documents/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'search-documents/{}'.format(VERSION)) self._configure(**kwargs) def _configure( - self, **kwargs # type: Any + self, + **kwargs # type: Any ): # type: (...) -> None - self.user_agent_policy = kwargs.get( - "user_agent_policy" - ) or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy( - **kwargs - ) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get( - "logging_policy" - ) or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get( - "http_logging_policy" - ) or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get( - "custom_hook_policy" - ) or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy( - **kwargs - ) - self.authentication_policy = kwargs.get("authentication_policy") + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/_search_client.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/_search_client.py index 3cafd591ad42..cf5857632715 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/_search_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/_search_client.py @@ -40,20 +40,17 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - base_url = "{endpoint}/indexes('{indexName}')" + base_url = '{endpoint}/indexes(\'{indexName}\')' self._config = SearchClientConfiguration(endpoint, index_name, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = { - k: v for k, v in models.__dict__.items() if isinstance(v, type) - } + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.documents = DocumentsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self._client, self._config, self._serialize, self._deserialize) def _send_request(self, http_request, **kwargs): # type: (HttpRequest, Any) -> HttpResponse @@ -66,20 +63,12 @@ def _send_request(self, http_request, **kwargs): :rtype: ~azure.core.pipeline.transport.HttpResponse """ path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } - http_request.url = self._client.format_url( - http_request.url, **path_format_arguments - ) + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run( - http_request, stream=stream, **kwargs - ) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) return pipeline_response.http_response def close(self): diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/__init__.py index e55e93659613..ec41d54fc046 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/__init__.py @@ -7,5 +7,4 @@ # -------------------------------------------------------------------------- from ._search_client import SearchClient - -__all__ = ["SearchClient"] +__all__ = ['SearchClient'] diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_configuration.py index 138296bbf2b4..ff2480b785c2 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_configuration.py @@ -13,7 +13,6 @@ VERSION = "unknown" - class SearchClientConfiguration(Configuration): """Configuration for SearchClient. @@ -26,7 +25,12 @@ class SearchClientConfiguration(Configuration): :type index_name: str """ - def __init__(self, endpoint: str, index_name: str, **kwargs: Any) -> None: + def __init__( + self, + endpoint: str, + index_name: str, + **kwargs: Any + ) -> None: if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") if index_name is None: @@ -36,30 +40,19 @@ def __init__(self, endpoint: str, index_name: str, **kwargs: Any) -> None: self.endpoint = endpoint self.index_name = index_name self.api_version = "2021-04-30-Preview" - kwargs.setdefault("sdk_moniker", "search-documents/{}".format(VERSION)) + kwargs.setdefault('sdk_moniker', 'search-documents/{}'.format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get( - "user_agent_policy" - ) or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy( - **kwargs - ) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get( - "logging_policy" - ) or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get( - "http_logging_policy" - ) or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy( - **kwargs - ) - self.custom_hook_policy = kwargs.get( - "custom_hook_policy" - ) or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get( - "redirect_policy" - ) or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_search_client.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_search_client.py index 19ea6e44e5ea..7799d633940a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_search_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_search_client.py @@ -28,27 +28,25 @@ class SearchClient(object): :type index_name: str """ - def __init__(self, endpoint: str, index_name: str, **kwargs: Any) -> None: - base_url = "{endpoint}/indexes('{indexName}')" + def __init__( + self, + endpoint: str, + index_name: str, + **kwargs: Any + ) -> None: + base_url = '{endpoint}/indexes(\'{indexName}\')' self._config = SearchClientConfiguration(endpoint, index_name, **kwargs) - self._client = AsyncPipelineClient( - base_url=base_url, config=self._config, **kwargs - ) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = { - k: v for k, v in models.__dict__.items() if isinstance(v, type) - } + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.documents = DocumentsOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self._client, self._config, self._serialize, self._deserialize) - async def _send_request( - self, http_request: HttpRequest, **kwargs: Any - ) -> AsyncHttpResponse: + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: """Runs the network request through the client's chained policies. :param http_request: The network request you want to make. Required. @@ -58,20 +56,12 @@ async def _send_request( :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse """ path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } - http_request.url = self._client.format_url( - http_request.url, **path_format_arguments - ) + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run( - http_request, stream=stream, **kwargs - ) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) return pipeline_response.http_response async def close(self) -> None: diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/__init__.py index b0e711ee0870..76022eb9d305 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/__init__.py @@ -9,5 +9,5 @@ from ._documents_operations import DocumentsOperations __all__ = [ - "DocumentsOperations", + 'DocumentsOperations', ] diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/_documents_operations.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/_documents_operations.py index 24b89fd6beb1..58668b2ccdef 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/_documents_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/_documents_operations.py @@ -8,23 +8,14 @@ from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from ... import models as _models -T = TypeVar("T") -ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any] -] - +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DocumentsOperations: """DocumentsOperations async operations. @@ -49,7 +40,9 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config async def count( - self, request_options: Optional["_models.RequestOptions"] = None, **kwargs: Any + self, + request_options: Optional["_models.RequestOptions"] = None, + **kwargs: Any ) -> int: """Queries the number of documents in the index. @@ -60,14 +53,12 @@ async def count( :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] + cls = kwargs.pop('cls', None) # type: ClsType[int] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -75,54 +66,39 @@ async def count( accept = "application/json" # Construct URL - url = self.count.metadata["url"] # type: ignore + url = self.count.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("long", pipeline_response) + deserialized = self._deserialize('long', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - count.metadata = {"url": "/docs/$count"} # type: ignore + count.metadata = {'url': '/docs/$count'} # type: ignore async def search_get( self, @@ -145,14 +121,12 @@ async def search_get( :rtype: ~azure.search.documents.models.SearchDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SearchDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _include_total_result_count = None _facets = None _filter = None @@ -207,150 +181,87 @@ async def search_get( accept = "application/json" # Construct URL - url = self.search_get.metadata["url"] # type: ignore + url = self.search_get.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] if search_text is not None: - query_parameters["search"] = self._serialize.query( - "search_text", search_text, "str" - ) + query_parameters['search'] = self._serialize.query("search_text", search_text, 'str') if _include_total_result_count is not None: - query_parameters["$count"] = self._serialize.query( - "include_total_result_count", _include_total_result_count, "bool" - ) + query_parameters['$count'] = self._serialize.query("include_total_result_count", _include_total_result_count, 'bool') if _facets is not None: - query_parameters["facet"] = [ - self._serialize.query("facets", q, "str") if q is not None else "" - for q in _facets - ] + query_parameters['facet'] = [self._serialize.query("facets", q, 'str') if q is not None else '' for q in _facets] if _filter is not None: - query_parameters["$filter"] = self._serialize.query( - "filter", _filter, "str" - ) + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') if _highlight_fields is not None: - query_parameters["highlight"] = self._serialize.query( - "highlight_fields", _highlight_fields, "[str]", div="," - ) + query_parameters['highlight'] = self._serialize.query("highlight_fields", _highlight_fields, '[str]', div=',') if _highlight_post_tag is not None: - query_parameters["highlightPostTag"] = self._serialize.query( - "highlight_post_tag", _highlight_post_tag, "str" - ) + query_parameters['highlightPostTag'] = self._serialize.query("highlight_post_tag", _highlight_post_tag, 'str') if _highlight_pre_tag is not None: - query_parameters["highlightPreTag"] = self._serialize.query( - "highlight_pre_tag", _highlight_pre_tag, "str" - ) + query_parameters['highlightPreTag'] = self._serialize.query("highlight_pre_tag", _highlight_pre_tag, 'str') if _minimum_coverage is not None: - query_parameters["minimumCoverage"] = self._serialize.query( - "minimum_coverage", _minimum_coverage, "float" - ) + query_parameters['minimumCoverage'] = self._serialize.query("minimum_coverage", _minimum_coverage, 'float') if _order_by is not None: - query_parameters["$orderby"] = self._serialize.query( - "order_by", _order_by, "[str]", div="," - ) + query_parameters['$orderby'] = self._serialize.query("order_by", _order_by, '[str]', div=',') if _query_type is not None: - query_parameters["queryType"] = self._serialize.query( - "query_type", _query_type, "str" - ) + query_parameters['queryType'] = self._serialize.query("query_type", _query_type, 'str') if _scoring_parameters is not None: - query_parameters["scoringParameter"] = [ - self._serialize.query("scoring_parameters", q, "str") - if q is not None - else "" - for q in _scoring_parameters - ] + query_parameters['scoringParameter'] = [self._serialize.query("scoring_parameters", q, 'str') if q is not None else '' for q in _scoring_parameters] if _scoring_profile is not None: - query_parameters["scoringProfile"] = self._serialize.query( - "scoring_profile", _scoring_profile, "str" - ) + query_parameters['scoringProfile'] = self._serialize.query("scoring_profile", _scoring_profile, 'str') if _search_fields is not None: - query_parameters["searchFields"] = self._serialize.query( - "search_fields", _search_fields, "[str]", div="," - ) + query_parameters['searchFields'] = self._serialize.query("search_fields", _search_fields, '[str]', div=',') if _query_language is not None: - query_parameters["queryLanguage"] = self._serialize.query( - "query_language", _query_language, "str" - ) + query_parameters['queryLanguage'] = self._serialize.query("query_language", _query_language, 'str') if _speller is not None: - query_parameters["speller"] = self._serialize.query( - "speller", _speller, "str" - ) + query_parameters['speller'] = self._serialize.query("speller", _speller, 'str') if _answers is not None: - query_parameters["answers"] = self._serialize.query( - "answers", _answers, "str" - ) + query_parameters['answers'] = self._serialize.query("answers", _answers, 'str') if _search_mode is not None: - query_parameters["searchMode"] = self._serialize.query( - "search_mode", _search_mode, "str" - ) + query_parameters['searchMode'] = self._serialize.query("search_mode", _search_mode, 'str') if _scoring_statistics is not None: - query_parameters["scoringStatistics"] = self._serialize.query( - "scoring_statistics", _scoring_statistics, "str" - ) + query_parameters['scoringStatistics'] = self._serialize.query("scoring_statistics", _scoring_statistics, 'str') if _session_id is not None: - query_parameters["sessionId"] = self._serialize.query( - "session_id", _session_id, "str" - ) + query_parameters['sessionId'] = self._serialize.query("session_id", _session_id, 'str') if _select is not None: - query_parameters["$select"] = self._serialize.query( - "select", _select, "[str]", div="," - ) + query_parameters['$select'] = self._serialize.query("select", _select, '[str]', div=',') if _skip is not None: - query_parameters["$skip"] = self._serialize.query("skip", _skip, "int") + query_parameters['$skip'] = self._serialize.query("skip", _skip, 'int') if _top is not None: - query_parameters["$top"] = self._serialize.query("top", _top, "int") + query_parameters['$top'] = self._serialize.query("top", _top, 'int') if _captions is not None: - query_parameters["captions"] = self._serialize.query( - "captions", _captions, "str" - ) + query_parameters['captions'] = self._serialize.query("captions", _captions, 'str') if _semantic_fields is not None: - query_parameters["semanticFields"] = self._serialize.query( - "semantic_fields", _semantic_fields, "[str]", div="," - ) - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['semanticFields'] = self._serialize.query("semantic_fields", _semantic_fields, '[str]', div=',') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SearchDocumentsResult", pipeline_response) + deserialized = self._deserialize('SearchDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - search_get.metadata = {"url": "/docs"} # type: ignore + search_get.metadata = {'url': '/docs'} # type: ignore async def search_post( self, @@ -369,14 +280,12 @@ async def search_post( :rtype: ~azure.search.documents.models.SearchDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SearchDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -385,62 +294,43 @@ async def search_post( accept = "application/json" # Construct URL - url = self.search_post.metadata["url"] # type: ignore + url = self.search_post.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Content-Type"] = self._serialize.header( - "content_type", content_type, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(search_request, "SearchRequest") - body_content_kwargs["content"] = body_content - request = self._client.post( - url, query_parameters, header_parameters, **body_content_kwargs - ) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + body_content = self._serialize.body(search_request, 'SearchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SearchDocumentsResult", pipeline_response) + deserialized = self._deserialize('SearchDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - search_post.metadata = {"url": "/docs/search.post.search"} # type: ignore + search_post.metadata = {'url': '/docs/search.post.search'} # type: ignore async def get( self, @@ -463,14 +353,12 @@ async def get( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[Any] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -478,59 +366,42 @@ async def get( accept = "application/json" # Construct URL - url = self.get.metadata["url"] # type: ignore + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), - "key": self._serialize.url("key", key, "str"), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), + 'key': self._serialize.url("key", key, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] if selected_fields is not None: - query_parameters["$select"] = self._serialize.query( - "selected_fields", selected_fields, "[str]", div="," - ) - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['$select'] = self._serialize.query("selected_fields", selected_fields, '[str]', div=',') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {"url": "/docs('{key}')"} # type: ignore + get.metadata = {'url': '/docs(\'{key}\')'} # type: ignore async def suggest_get( self, @@ -557,14 +428,12 @@ async def suggest_get( :rtype: ~azure.search.documents.models.SuggestDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SuggestDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SuggestDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _filter = None _use_fuzzy_matching = None _highlight_post_tag = None @@ -591,94 +460,59 @@ async def suggest_get( accept = "application/json" # Construct URL - url = self.suggest_get.metadata["url"] # type: ignore + url = self.suggest_get.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["search"] = self._serialize.query( - "search_text", search_text, "str" - ) - query_parameters["suggesterName"] = self._serialize.query( - "suggester_name", suggester_name, "str" - ) + query_parameters['search'] = self._serialize.query("search_text", search_text, 'str') + query_parameters['suggesterName'] = self._serialize.query("suggester_name", suggester_name, 'str') if _filter is not None: - query_parameters["$filter"] = self._serialize.query( - "filter", _filter, "str" - ) + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') if _use_fuzzy_matching is not None: - query_parameters["fuzzy"] = self._serialize.query( - "use_fuzzy_matching", _use_fuzzy_matching, "bool" - ) + query_parameters['fuzzy'] = self._serialize.query("use_fuzzy_matching", _use_fuzzy_matching, 'bool') if _highlight_post_tag is not None: - query_parameters["highlightPostTag"] = self._serialize.query( - "highlight_post_tag", _highlight_post_tag, "str" - ) + query_parameters['highlightPostTag'] = self._serialize.query("highlight_post_tag", _highlight_post_tag, 'str') if _highlight_pre_tag is not None: - query_parameters["highlightPreTag"] = self._serialize.query( - "highlight_pre_tag", _highlight_pre_tag, "str" - ) + query_parameters['highlightPreTag'] = self._serialize.query("highlight_pre_tag", _highlight_pre_tag, 'str') if _minimum_coverage is not None: - query_parameters["minimumCoverage"] = self._serialize.query( - "minimum_coverage", _minimum_coverage, "float" - ) + query_parameters['minimumCoverage'] = self._serialize.query("minimum_coverage", _minimum_coverage, 'float') if _order_by is not None: - query_parameters["$orderby"] = self._serialize.query( - "order_by", _order_by, "[str]", div="," - ) + query_parameters['$orderby'] = self._serialize.query("order_by", _order_by, '[str]', div=',') if _search_fields is not None: - query_parameters["searchFields"] = self._serialize.query( - "search_fields", _search_fields, "[str]", div="," - ) + query_parameters['searchFields'] = self._serialize.query("search_fields", _search_fields, '[str]', div=',') if _select is not None: - query_parameters["$select"] = self._serialize.query( - "select", _select, "[str]", div="," - ) + query_parameters['$select'] = self._serialize.query("select", _select, '[str]', div=',') if _top is not None: - query_parameters["$top"] = self._serialize.query("top", _top, "int") - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['$top'] = self._serialize.query("top", _top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SuggestDocumentsResult", pipeline_response) + deserialized = self._deserialize('SuggestDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - suggest_get.metadata = {"url": "/docs/search.suggest"} # type: ignore + suggest_get.metadata = {'url': '/docs/search.suggest'} # type: ignore async def suggest_post( self, @@ -697,14 +531,12 @@ async def suggest_post( :rtype: ~azure.search.documents.models.SuggestDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SuggestDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SuggestDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -713,62 +545,43 @@ async def suggest_post( accept = "application/json" # Construct URL - url = self.suggest_post.metadata["url"] # type: ignore + url = self.suggest_post.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Content-Type"] = self._serialize.header( - "content_type", content_type, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(suggest_request, "SuggestRequest") - body_content_kwargs["content"] = body_content - request = self._client.post( - url, query_parameters, header_parameters, **body_content_kwargs - ) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + body_content = self._serialize.body(suggest_request, 'SuggestRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SuggestDocumentsResult", pipeline_response) + deserialized = self._deserialize('SuggestDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - suggest_post.metadata = {"url": "/docs/search.post.suggest"} # type: ignore + suggest_post.metadata = {'url': '/docs/search.post.suggest'} # type: ignore async def index( self, @@ -787,14 +600,12 @@ async def index( :rtype: ~azure.search.documents.models.IndexDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.IndexDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IndexDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -805,66 +616,47 @@ async def index( accept = "application/json" # Construct URL - url = self.index.metadata["url"] # type: ignore + url = self.index.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Content-Type"] = self._serialize.header( - "content_type", content_type, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_batch, "IndexBatch") - body_content_kwargs["content"] = body_content - request = self._client.post( - url, query_parameters, header_parameters, **body_content_kwargs - ) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + body_content = self._serialize.body(_batch, 'IndexBatch') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 207]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("IndexDocumentsResult", pipeline_response) + deserialized = self._deserialize('IndexDocumentsResult', pipeline_response) if response.status_code == 207: - deserialized = self._deserialize("IndexDocumentsResult", pipeline_response) + deserialized = self._deserialize('IndexDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - index.metadata = {"url": "/docs/search.index"} # type: ignore + index.metadata = {'url': '/docs/search.index'} # type: ignore async def autocomplete_get( self, @@ -890,14 +682,12 @@ async def autocomplete_get( :rtype: ~azure.search.documents.models.AutocompleteResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.AutocompleteResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutocompleteResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None _autocomplete_mode = None _filter = None @@ -922,90 +712,57 @@ async def autocomplete_get( accept = "application/json" # Construct URL - url = self.autocomplete_get.metadata["url"] # type: ignore + url = self.autocomplete_get.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) - query_parameters["search"] = self._serialize.query( - "search_text", search_text, "str" - ) - query_parameters["suggesterName"] = self._serialize.query( - "suggester_name", suggester_name, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['search'] = self._serialize.query("search_text", search_text, 'str') + query_parameters['suggesterName'] = self._serialize.query("suggester_name", suggester_name, 'str') if _autocomplete_mode is not None: - query_parameters["autocompleteMode"] = self._serialize.query( - "autocomplete_mode", _autocomplete_mode, "str" - ) + query_parameters['autocompleteMode'] = self._serialize.query("autocomplete_mode", _autocomplete_mode, 'str') if _filter is not None: - query_parameters["$filter"] = self._serialize.query( - "filter", _filter, "str" - ) + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') if _use_fuzzy_matching is not None: - query_parameters["fuzzy"] = self._serialize.query( - "use_fuzzy_matching", _use_fuzzy_matching, "bool" - ) + query_parameters['fuzzy'] = self._serialize.query("use_fuzzy_matching", _use_fuzzy_matching, 'bool') if _highlight_post_tag is not None: - query_parameters["highlightPostTag"] = self._serialize.query( - "highlight_post_tag", _highlight_post_tag, "str" - ) + query_parameters['highlightPostTag'] = self._serialize.query("highlight_post_tag", _highlight_post_tag, 'str') if _highlight_pre_tag is not None: - query_parameters["highlightPreTag"] = self._serialize.query( - "highlight_pre_tag", _highlight_pre_tag, "str" - ) + query_parameters['highlightPreTag'] = self._serialize.query("highlight_pre_tag", _highlight_pre_tag, 'str') if _minimum_coverage is not None: - query_parameters["minimumCoverage"] = self._serialize.query( - "minimum_coverage", _minimum_coverage, "float" - ) + query_parameters['minimumCoverage'] = self._serialize.query("minimum_coverage", _minimum_coverage, 'float') if _search_fields is not None: - query_parameters["searchFields"] = self._serialize.query( - "search_fields", _search_fields, "[str]", div="," - ) + query_parameters['searchFields'] = self._serialize.query("search_fields", _search_fields, '[str]', div=',') if _top is not None: - query_parameters["$top"] = self._serialize.query("top", _top, "int") + query_parameters['$top'] = self._serialize.query("top", _top, 'int') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("AutocompleteResult", pipeline_response) + deserialized = self._deserialize('AutocompleteResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - autocomplete_get.metadata = {"url": "/docs/search.autocomplete"} # type: ignore + autocomplete_get.metadata = {'url': '/docs/search.autocomplete'} # type: ignore async def autocomplete_post( self, @@ -1024,14 +781,12 @@ async def autocomplete_post( :rtype: ~azure.search.documents.models.AutocompleteResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.AutocompleteResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutocompleteResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -1040,59 +795,40 @@ async def autocomplete_post( accept = "application/json" # Construct URL - url = self.autocomplete_post.metadata["url"] # type: ignore + url = self.autocomplete_post.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Content-Type"] = self._serialize.header( - "content_type", content_type, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(autocomplete_request, "AutocompleteRequest") - body_content_kwargs["content"] = body_content - request = self._client.post( - url, query_parameters, header_parameters, **body_content_kwargs - ) - pipeline_response = await self._client._pipeline.run( - request, stream=False, **kwargs - ) + body_content = self._serialize.body(autocomplete_request, 'AutocompleteRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("AutocompleteResult", pipeline_response) + deserialized = self._deserialize('AutocompleteResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - autocomplete_post.metadata = {"url": "/docs/search.post.autocomplete"} # type: ignore + autocomplete_post.metadata = {'url': '/docs/search.post.autocomplete'} # type: ignore diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/models/__init__.py index d970ddc2edc4..cec096d25420 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/models/__init__.py @@ -64,34 +64,34 @@ ) __all__ = [ - "AnswerResult", - "AutocompleteItem", - "AutocompleteOptions", - "AutocompleteRequest", - "AutocompleteResult", - "CaptionResult", - "FacetResult", - "IndexAction", - "IndexBatch", - "IndexDocumentsResult", - "IndexingResult", - "RequestOptions", - "SearchDocumentsResult", - "SearchError", - "SearchOptions", - "SearchRequest", - "SearchResult", - "SuggestDocumentsResult", - "SuggestOptions", - "SuggestRequest", - "SuggestResult", - "Answers", - "AutocompleteMode", - "Captions", - "IndexActionType", - "QueryLanguage", - "QueryType", - "ScoringStatistics", - "SearchMode", - "Speller", + 'AnswerResult', + 'AutocompleteItem', + 'AutocompleteOptions', + 'AutocompleteRequest', + 'AutocompleteResult', + 'CaptionResult', + 'FacetResult', + 'IndexAction', + 'IndexBatch', + 'IndexDocumentsResult', + 'IndexingResult', + 'RequestOptions', + 'SearchDocumentsResult', + 'SearchError', + 'SearchOptions', + 'SearchRequest', + 'SearchResult', + 'SuggestDocumentsResult', + 'SuggestOptions', + 'SuggestRequest', + 'SuggestResult', + 'Answers', + 'AutocompleteMode', + 'Captions', + 'IndexActionType', + 'QueryLanguage', + 'QueryType', + 'ScoringStatistics', + 'SearchMode', + 'Speller', ] diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_models.py index 37794d8944af..3c18d1464a26 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_models.py @@ -31,23 +31,26 @@ class AnswerResult(msrest.serialization.Model): """ _validation = { - "score": {"readonly": True}, - "key": {"readonly": True}, - "text": {"readonly": True}, - "highlights": {"readonly": True}, + 'score': {'readonly': True}, + 'key': {'readonly': True}, + 'text': {'readonly': True}, + 'highlights': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "score": {"key": "score", "type": "float"}, - "key": {"key": "key", "type": "str"}, - "text": {"key": "text", "type": "str"}, - "highlights": {"key": "highlights", "type": "str"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'score': {'key': 'score', 'type': 'float'}, + 'key': {'key': 'key', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'highlights': {'key': 'highlights', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AnswerResult, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) + self.additional_properties = kwargs.get('additional_properties', None) self.score = None self.key = None self.text = None @@ -68,16 +71,19 @@ class AutocompleteItem(msrest.serialization.Model): """ _validation = { - "text": {"required": True, "readonly": True}, - "query_plus_text": {"required": True, "readonly": True}, + 'text': {'required': True, 'readonly': True}, + 'query_plus_text': {'required': True, 'readonly': True}, } _attribute_map = { - "text": {"key": "text", "type": "str"}, - "query_plus_text": {"key": "queryPlusText", "type": "str"}, + 'text': {'key': 'text', 'type': 'str'}, + 'query_plus_text': {'key': 'queryPlusText', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutocompleteItem, self).__init__(**kwargs) self.text = None self.query_plus_text = None @@ -119,26 +125,29 @@ class AutocompleteOptions(msrest.serialization.Model): """ _attribute_map = { - "autocomplete_mode": {"key": "autocompleteMode", "type": "str"}, - "filter": {"key": "$filter", "type": "str"}, - "use_fuzzy_matching": {"key": "UseFuzzyMatching", "type": "bool"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "search_fields": {"key": "searchFields", "type": "[str]"}, - "top": {"key": "$top", "type": "int"}, + 'autocomplete_mode': {'key': 'autocompleteMode', 'type': 'str'}, + 'filter': {'key': '$filter', 'type': 'str'}, + 'use_fuzzy_matching': {'key': 'UseFuzzyMatching', 'type': 'bool'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'search_fields': {'key': 'searchFields', 'type': '[str]'}, + 'top': {'key': '$top', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutocompleteOptions, self).__init__(**kwargs) - self.autocomplete_mode = kwargs.get("autocomplete_mode", None) - self.filter = kwargs.get("filter", None) - self.use_fuzzy_matching = kwargs.get("use_fuzzy_matching", None) - self.highlight_post_tag = kwargs.get("highlight_post_tag", None) - self.highlight_pre_tag = kwargs.get("highlight_pre_tag", None) - self.minimum_coverage = kwargs.get("minimum_coverage", None) - self.search_fields = kwargs.get("search_fields", None) - self.top = kwargs.get("top", None) + self.autocomplete_mode = kwargs.get('autocomplete_mode', None) + self.filter = kwargs.get('filter', None) + self.use_fuzzy_matching = kwargs.get('use_fuzzy_matching', None) + self.highlight_post_tag = kwargs.get('highlight_post_tag', None) + self.highlight_pre_tag = kwargs.get('highlight_pre_tag', None) + self.minimum_coverage = kwargs.get('minimum_coverage', None) + self.search_fields = kwargs.get('search_fields', None) + self.top = kwargs.get('top', None) class AutocompleteRequest(msrest.serialization.Model): @@ -184,35 +193,38 @@ class AutocompleteRequest(msrest.serialization.Model): """ _validation = { - "search_text": {"required": True}, - "suggester_name": {"required": True}, + 'search_text': {'required': True}, + 'suggester_name': {'required': True}, } _attribute_map = { - "search_text": {"key": "search", "type": "str"}, - "autocomplete_mode": {"key": "autocompleteMode", "type": "str"}, - "filter": {"key": "filter", "type": "str"}, - "use_fuzzy_matching": {"key": "fuzzy", "type": "bool"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "search_fields": {"key": "searchFields", "type": "str"}, - "suggester_name": {"key": "suggesterName", "type": "str"}, - "top": {"key": "top", "type": "int"}, + 'search_text': {'key': 'search', 'type': 'str'}, + 'autocomplete_mode': {'key': 'autocompleteMode', 'type': 'str'}, + 'filter': {'key': 'filter', 'type': 'str'}, + 'use_fuzzy_matching': {'key': 'fuzzy', 'type': 'bool'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'search_fields': {'key': 'searchFields', 'type': 'str'}, + 'suggester_name': {'key': 'suggesterName', 'type': 'str'}, + 'top': {'key': 'top', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutocompleteRequest, self).__init__(**kwargs) - self.search_text = kwargs["search_text"] - self.autocomplete_mode = kwargs.get("autocomplete_mode", None) - self.filter = kwargs.get("filter", None) - self.use_fuzzy_matching = kwargs.get("use_fuzzy_matching", None) - self.highlight_post_tag = kwargs.get("highlight_post_tag", None) - self.highlight_pre_tag = kwargs.get("highlight_pre_tag", None) - self.minimum_coverage = kwargs.get("minimum_coverage", None) - self.search_fields = kwargs.get("search_fields", None) - self.suggester_name = kwargs["suggester_name"] - self.top = kwargs.get("top", None) + self.search_text = kwargs['search_text'] + self.autocomplete_mode = kwargs.get('autocomplete_mode', None) + self.filter = kwargs.get('filter', None) + self.use_fuzzy_matching = kwargs.get('use_fuzzy_matching', None) + self.highlight_post_tag = kwargs.get('highlight_post_tag', None) + self.highlight_pre_tag = kwargs.get('highlight_pre_tag', None) + self.minimum_coverage = kwargs.get('minimum_coverage', None) + self.search_fields = kwargs.get('search_fields', None) + self.suggester_name = kwargs['suggester_name'] + self.top = kwargs.get('top', None) class AutocompleteResult(msrest.serialization.Model): @@ -230,16 +242,19 @@ class AutocompleteResult(msrest.serialization.Model): """ _validation = { - "coverage": {"readonly": True}, - "results": {"required": True, "readonly": True}, + 'coverage': {'readonly': True}, + 'results': {'required': True, 'readonly': True}, } _attribute_map = { - "coverage": {"key": "@search\\.coverage", "type": "float"}, - "results": {"key": "value", "type": "[AutocompleteItem]"}, + 'coverage': {'key': '@search\\.coverage', 'type': 'float'}, + 'results': {'key': 'value', 'type': '[AutocompleteItem]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutocompleteResult, self).__init__(**kwargs) self.coverage = None self.results = None @@ -262,19 +277,22 @@ class CaptionResult(msrest.serialization.Model): """ _validation = { - "text": {"readonly": True}, - "highlights": {"readonly": True}, + 'text': {'readonly': True}, + 'highlights': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "text": {"key": "text", "type": "str"}, - "highlights": {"key": "highlights", "type": "str"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'text': {'key': 'text', 'type': 'str'}, + 'highlights': {'key': 'highlights', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CaptionResult, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) + self.additional_properties = kwargs.get('additional_properties', None) self.text = None self.highlights = None @@ -293,17 +311,20 @@ class FacetResult(msrest.serialization.Model): """ _validation = { - "count": {"readonly": True}, + 'count': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "count": {"key": "count", "type": "long"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'count': {'key': 'count', 'type': 'long'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(FacetResult, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) + self.additional_properties = kwargs.get('additional_properties', None) self.count = None @@ -319,14 +340,17 @@ class IndexAction(msrest.serialization.Model): """ _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "action_type": {"key": "@search\\.action", "type": "str"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'action_type': {'key': '@search\\.action', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IndexAction, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) - self.action_type = kwargs.get("action_type", None) + self.additional_properties = kwargs.get('additional_properties', None) + self.action_type = kwargs.get('action_type', None) class IndexBatch(msrest.serialization.Model): @@ -339,16 +363,19 @@ class IndexBatch(msrest.serialization.Model): """ _validation = { - "actions": {"required": True}, + 'actions': {'required': True}, } _attribute_map = { - "actions": {"key": "value", "type": "[IndexAction]"}, + 'actions': {'key': 'value', 'type': '[IndexAction]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IndexBatch, self).__init__(**kwargs) - self.actions = kwargs["actions"] + self.actions = kwargs['actions'] class IndexDocumentsResult(msrest.serialization.Model): @@ -364,14 +391,17 @@ class IndexDocumentsResult(msrest.serialization.Model): """ _validation = { - "results": {"required": True, "readonly": True}, + 'results': {'required': True, 'readonly': True}, } _attribute_map = { - "results": {"key": "value", "type": "[IndexingResult]"}, + 'results': {'key': 'value', 'type': '[IndexingResult]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IndexDocumentsResult, self).__init__(**kwargs) self.results = None @@ -399,20 +429,23 @@ class IndexingResult(msrest.serialization.Model): """ _validation = { - "key": {"required": True, "readonly": True}, - "error_message": {"readonly": True}, - "succeeded": {"required": True, "readonly": True}, - "status_code": {"required": True, "readonly": True}, + 'key': {'required': True, 'readonly': True}, + 'error_message': {'readonly': True}, + 'succeeded': {'required': True, 'readonly': True}, + 'status_code': {'required': True, 'readonly': True}, } _attribute_map = { - "key": {"key": "key", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "succeeded": {"key": "status", "type": "bool"}, - "status_code": {"key": "statusCode", "type": "int"}, + 'key': {'key': 'key', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'succeeded': {'key': 'status', 'type': 'bool'}, + 'status_code': {'key': 'statusCode', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IndexingResult, self).__init__(**kwargs) self.key = None self.error_message = None @@ -428,12 +461,15 @@ class RequestOptions(msrest.serialization.Model): """ _attribute_map = { - "x_ms_client_request_id": {"key": "x-ms-client-request-id", "type": "str"}, + 'x_ms_client_request_id': {'key': 'x-ms-client-request-id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(RequestOptions, self).__init__(**kwargs) - self.x_ms_client_request_id = kwargs.get("x_ms_client_request_id", None) + self.x_ms_client_request_id = kwargs.get('x_ms_client_request_id', None) class SearchDocumentsResult(msrest.serialization.Model): @@ -472,29 +508,29 @@ class SearchDocumentsResult(msrest.serialization.Model): """ _validation = { - "count": {"readonly": True}, - "coverage": {"readonly": True}, - "facets": {"readonly": True}, - "answers": {"readonly": True}, - "next_page_parameters": {"readonly": True}, - "results": {"required": True, "readonly": True}, - "next_link": {"readonly": True}, + 'count': {'readonly': True}, + 'coverage': {'readonly': True}, + 'facets': {'readonly': True}, + 'answers': {'readonly': True}, + 'next_page_parameters': {'readonly': True}, + 'results': {'required': True, 'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - "count": {"key": "@odata\\.count", "type": "long"}, - "coverage": {"key": "@search\\.coverage", "type": "float"}, - "facets": {"key": "@search\\.facets", "type": "{[FacetResult]}"}, - "answers": {"key": "@search\\.answers", "type": "[AnswerResult]"}, - "next_page_parameters": { - "key": "@search\\.nextPageParameters", - "type": "SearchRequest", - }, - "results": {"key": "value", "type": "[SearchResult]"}, - "next_link": {"key": "@odata\\.nextLink", "type": "str"}, + 'count': {'key': '@odata\\.count', 'type': 'long'}, + 'coverage': {'key': '@search\\.coverage', 'type': 'float'}, + 'facets': {'key': '@search\\.facets', 'type': '{[FacetResult]}'}, + 'answers': {'key': '@search\\.answers', 'type': '[AnswerResult]'}, + 'next_page_parameters': {'key': '@search\\.nextPageParameters', 'type': 'SearchRequest'}, + 'results': {'key': 'value', 'type': '[SearchResult]'}, + 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SearchDocumentsResult, self).__init__(**kwargs) self.count = None self.coverage = None @@ -521,18 +557,21 @@ class SearchError(msrest.serialization.Model): """ _validation = { - "code": {"readonly": True}, - "message": {"required": True, "readonly": True}, - "details": {"readonly": True}, + 'code': {'readonly': True}, + 'message': {'required': True, 'readonly': True}, + 'details': {'readonly': True}, } _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[SearchError]"}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[SearchError]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SearchError, self).__init__(**kwargs) self.code = None self.message = None @@ -637,59 +676,59 @@ class SearchOptions(msrest.serialization.Model): """ _attribute_map = { - "include_total_result_count": { - "key": "IncludeTotalResultCount", - "type": "bool", - }, - "facets": {"key": "Facets", "type": "[str]"}, - "filter": {"key": "$filter", "type": "str"}, - "highlight_fields": {"key": "HighlightFields", "type": "[str]"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "order_by": {"key": "OrderBy", "type": "[str]"}, - "query_type": {"key": "queryType", "type": "str"}, - "scoring_parameters": {"key": "ScoringParameters", "type": "[str]"}, - "scoring_profile": {"key": "scoringProfile", "type": "str"}, - "search_fields": {"key": "searchFields", "type": "[str]"}, - "query_language": {"key": "queryLanguage", "type": "str"}, - "speller": {"key": "speller", "type": "str"}, - "answers": {"key": "answers", "type": "str"}, - "search_mode": {"key": "searchMode", "type": "str"}, - "scoring_statistics": {"key": "scoringStatistics", "type": "str"}, - "session_id": {"key": "sessionId", "type": "str"}, - "select": {"key": "$select", "type": "[str]"}, - "skip": {"key": "$skip", "type": "int"}, - "top": {"key": "$top", "type": "int"}, - "captions": {"key": "captions", "type": "str"}, - "semantic_fields": {"key": "semanticFields", "type": "[str]"}, + 'include_total_result_count': {'key': 'IncludeTotalResultCount', 'type': 'bool'}, + 'facets': {'key': 'Facets', 'type': '[str]'}, + 'filter': {'key': '$filter', 'type': 'str'}, + 'highlight_fields': {'key': 'HighlightFields', 'type': '[str]'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'order_by': {'key': 'OrderBy', 'type': '[str]'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + 'scoring_parameters': {'key': 'ScoringParameters', 'type': '[str]'}, + 'scoring_profile': {'key': 'scoringProfile', 'type': 'str'}, + 'search_fields': {'key': 'searchFields', 'type': '[str]'}, + 'query_language': {'key': 'queryLanguage', 'type': 'str'}, + 'speller': {'key': 'speller', 'type': 'str'}, + 'answers': {'key': 'answers', 'type': 'str'}, + 'search_mode': {'key': 'searchMode', 'type': 'str'}, + 'scoring_statistics': {'key': 'scoringStatistics', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'select': {'key': '$select', 'type': '[str]'}, + 'skip': {'key': '$skip', 'type': 'int'}, + 'top': {'key': '$top', 'type': 'int'}, + 'captions': {'key': 'captions', 'type': 'str'}, + 'semantic_fields': {'key': 'semanticFields', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SearchOptions, self).__init__(**kwargs) - self.include_total_result_count = kwargs.get("include_total_result_count", None) - self.facets = kwargs.get("facets", None) - self.filter = kwargs.get("filter", None) - self.highlight_fields = kwargs.get("highlight_fields", None) - self.highlight_post_tag = kwargs.get("highlight_post_tag", None) - self.highlight_pre_tag = kwargs.get("highlight_pre_tag", None) - self.minimum_coverage = kwargs.get("minimum_coverage", None) - self.order_by = kwargs.get("order_by", None) - self.query_type = kwargs.get("query_type", None) - self.scoring_parameters = kwargs.get("scoring_parameters", None) - self.scoring_profile = kwargs.get("scoring_profile", None) - self.search_fields = kwargs.get("search_fields", None) - self.query_language = kwargs.get("query_language", None) - self.speller = kwargs.get("speller", None) - self.answers = kwargs.get("answers", None) - self.search_mode = kwargs.get("search_mode", None) - self.scoring_statistics = kwargs.get("scoring_statistics", None) - self.session_id = kwargs.get("session_id", None) - self.select = kwargs.get("select", None) - self.skip = kwargs.get("skip", None) - self.top = kwargs.get("top", None) - self.captions = kwargs.get("captions", None) - self.semantic_fields = kwargs.get("semantic_fields", None) + self.include_total_result_count = kwargs.get('include_total_result_count', None) + self.facets = kwargs.get('facets', None) + self.filter = kwargs.get('filter', None) + self.highlight_fields = kwargs.get('highlight_fields', None) + self.highlight_post_tag = kwargs.get('highlight_post_tag', None) + self.highlight_pre_tag = kwargs.get('highlight_pre_tag', None) + self.minimum_coverage = kwargs.get('minimum_coverage', None) + self.order_by = kwargs.get('order_by', None) + self.query_type = kwargs.get('query_type', None) + self.scoring_parameters = kwargs.get('scoring_parameters', None) + self.scoring_profile = kwargs.get('scoring_profile', None) + self.search_fields = kwargs.get('search_fields', None) + self.query_language = kwargs.get('query_language', None) + self.speller = kwargs.get('speller', None) + self.answers = kwargs.get('answers', None) + self.search_mode = kwargs.get('search_mode', None) + self.scoring_statistics = kwargs.get('scoring_statistics', None) + self.session_id = kwargs.get('session_id', None) + self.select = kwargs.get('select', None) + self.skip = kwargs.get('skip', None) + self.top = kwargs.get('top', None) + self.captions = kwargs.get('captions', None) + self.semantic_fields = kwargs.get('semantic_fields', None) class SearchRequest(msrest.serialization.Model): @@ -791,58 +830,61 @@ class SearchRequest(msrest.serialization.Model): """ _attribute_map = { - "include_total_result_count": {"key": "count", "type": "bool"}, - "facets": {"key": "facets", "type": "[str]"}, - "filter": {"key": "filter", "type": "str"}, - "highlight_fields": {"key": "highlight", "type": "str"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "order_by": {"key": "orderby", "type": "str"}, - "query_type": {"key": "queryType", "type": "str"}, - "scoring_statistics": {"key": "scoringStatistics", "type": "str"}, - "session_id": {"key": "sessionId", "type": "str"}, - "scoring_parameters": {"key": "scoringParameters", "type": "[str]"}, - "scoring_profile": {"key": "scoringProfile", "type": "str"}, - "search_text": {"key": "search", "type": "str"}, - "search_fields": {"key": "searchFields", "type": "str"}, - "search_mode": {"key": "searchMode", "type": "str"}, - "query_language": {"key": "queryLanguage", "type": "str"}, - "speller": {"key": "speller", "type": "str"}, - "answers": {"key": "answers", "type": "str"}, - "select": {"key": "select", "type": "str"}, - "skip": {"key": "skip", "type": "int"}, - "top": {"key": "top", "type": "int"}, - "captions": {"key": "captions", "type": "str"}, - "semantic_fields": {"key": "semanticFields", "type": "str"}, + 'include_total_result_count': {'key': 'count', 'type': 'bool'}, + 'facets': {'key': 'facets', 'type': '[str]'}, + 'filter': {'key': 'filter', 'type': 'str'}, + 'highlight_fields': {'key': 'highlight', 'type': 'str'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'order_by': {'key': 'orderby', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + 'scoring_statistics': {'key': 'scoringStatistics', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'scoring_parameters': {'key': 'scoringParameters', 'type': '[str]'}, + 'scoring_profile': {'key': 'scoringProfile', 'type': 'str'}, + 'search_text': {'key': 'search', 'type': 'str'}, + 'search_fields': {'key': 'searchFields', 'type': 'str'}, + 'search_mode': {'key': 'searchMode', 'type': 'str'}, + 'query_language': {'key': 'queryLanguage', 'type': 'str'}, + 'speller': {'key': 'speller', 'type': 'str'}, + 'answers': {'key': 'answers', 'type': 'str'}, + 'select': {'key': 'select', 'type': 'str'}, + 'skip': {'key': 'skip', 'type': 'int'}, + 'top': {'key': 'top', 'type': 'int'}, + 'captions': {'key': 'captions', 'type': 'str'}, + 'semantic_fields': {'key': 'semanticFields', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SearchRequest, self).__init__(**kwargs) - self.include_total_result_count = kwargs.get("include_total_result_count", None) - self.facets = kwargs.get("facets", None) - self.filter = kwargs.get("filter", None) - self.highlight_fields = kwargs.get("highlight_fields", None) - self.highlight_post_tag = kwargs.get("highlight_post_tag", None) - self.highlight_pre_tag = kwargs.get("highlight_pre_tag", None) - self.minimum_coverage = kwargs.get("minimum_coverage", None) - self.order_by = kwargs.get("order_by", None) - self.query_type = kwargs.get("query_type", None) - self.scoring_statistics = kwargs.get("scoring_statistics", None) - self.session_id = kwargs.get("session_id", None) - self.scoring_parameters = kwargs.get("scoring_parameters", None) - self.scoring_profile = kwargs.get("scoring_profile", None) - self.search_text = kwargs.get("search_text", None) - self.search_fields = kwargs.get("search_fields", None) - self.search_mode = kwargs.get("search_mode", None) - self.query_language = kwargs.get("query_language", None) - self.speller = kwargs.get("speller", None) - self.answers = kwargs.get("answers", None) - self.select = kwargs.get("select", None) - self.skip = kwargs.get("skip", None) - self.top = kwargs.get("top", None) - self.captions = kwargs.get("captions", None) - self.semantic_fields = kwargs.get("semantic_fields", None) + self.include_total_result_count = kwargs.get('include_total_result_count', None) + self.facets = kwargs.get('facets', None) + self.filter = kwargs.get('filter', None) + self.highlight_fields = kwargs.get('highlight_fields', None) + self.highlight_post_tag = kwargs.get('highlight_post_tag', None) + self.highlight_pre_tag = kwargs.get('highlight_pre_tag', None) + self.minimum_coverage = kwargs.get('minimum_coverage', None) + self.order_by = kwargs.get('order_by', None) + self.query_type = kwargs.get('query_type', None) + self.scoring_statistics = kwargs.get('scoring_statistics', None) + self.session_id = kwargs.get('session_id', None) + self.scoring_parameters = kwargs.get('scoring_parameters', None) + self.scoring_profile = kwargs.get('scoring_profile', None) + self.search_text = kwargs.get('search_text', None) + self.search_fields = kwargs.get('search_fields', None) + self.search_mode = kwargs.get('search_mode', None) + self.query_language = kwargs.get('query_language', None) + self.speller = kwargs.get('speller', None) + self.answers = kwargs.get('answers', None) + self.select = kwargs.get('select', None) + self.skip = kwargs.get('skip', None) + self.top = kwargs.get('top', None) + self.captions = kwargs.get('captions', None) + self.semantic_fields = kwargs.get('semantic_fields', None) class SearchResult(msrest.serialization.Model): @@ -872,23 +914,26 @@ class SearchResult(msrest.serialization.Model): """ _validation = { - "score": {"required": True, "readonly": True}, - "reranker_score": {"readonly": True}, - "highlights": {"readonly": True}, - "captions": {"readonly": True}, + 'score': {'required': True, 'readonly': True}, + 'reranker_score': {'readonly': True}, + 'highlights': {'readonly': True}, + 'captions': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "score": {"key": "@search\\.score", "type": "float"}, - "reranker_score": {"key": "@search\\.rerankerScore", "type": "float"}, - "highlights": {"key": "@search\\.highlights", "type": "{[str]}"}, - "captions": {"key": "@search\\.captions", "type": "[CaptionResult]"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'score': {'key': '@search\\.score', 'type': 'float'}, + 'reranker_score': {'key': '@search\\.rerankerScore', 'type': 'float'}, + 'highlights': {'key': '@search\\.highlights', 'type': '{[str]}'}, + 'captions': {'key': '@search\\.captions', 'type': '[CaptionResult]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SearchResult, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) + self.additional_properties = kwargs.get('additional_properties', None) self.score = None self.reranker_score = None self.highlights = None @@ -910,16 +955,19 @@ class SuggestDocumentsResult(msrest.serialization.Model): """ _validation = { - "results": {"required": True, "readonly": True}, - "coverage": {"readonly": True}, + 'results': {'required': True, 'readonly': True}, + 'coverage': {'readonly': True}, } _attribute_map = { - "results": {"key": "value", "type": "[SuggestResult]"}, - "coverage": {"key": "@search\\.coverage", "type": "float"}, + 'results': {'key': 'value', 'type': '[SuggestResult]'}, + 'coverage': {'key': '@search\\.coverage', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SuggestDocumentsResult, self).__init__(**kwargs) self.results = None self.coverage = None @@ -966,28 +1014,31 @@ class SuggestOptions(msrest.serialization.Model): """ _attribute_map = { - "filter": {"key": "$filter", "type": "str"}, - "use_fuzzy_matching": {"key": "UseFuzzyMatching", "type": "bool"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "order_by": {"key": "OrderBy", "type": "[str]"}, - "search_fields": {"key": "searchFields", "type": "[str]"}, - "select": {"key": "$select", "type": "[str]"}, - "top": {"key": "$top", "type": "int"}, + 'filter': {'key': '$filter', 'type': 'str'}, + 'use_fuzzy_matching': {'key': 'UseFuzzyMatching', 'type': 'bool'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'order_by': {'key': 'OrderBy', 'type': '[str]'}, + 'search_fields': {'key': 'searchFields', 'type': '[str]'}, + 'select': {'key': '$select', 'type': '[str]'}, + 'top': {'key': '$top', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SuggestOptions, self).__init__(**kwargs) - self.filter = kwargs.get("filter", None) - self.use_fuzzy_matching = kwargs.get("use_fuzzy_matching", None) - self.highlight_post_tag = kwargs.get("highlight_post_tag", None) - self.highlight_pre_tag = kwargs.get("highlight_pre_tag", None) - self.minimum_coverage = kwargs.get("minimum_coverage", None) - self.order_by = kwargs.get("order_by", None) - self.search_fields = kwargs.get("search_fields", None) - self.select = kwargs.get("select", None) - self.top = kwargs.get("top", None) + self.filter = kwargs.get('filter', None) + self.use_fuzzy_matching = kwargs.get('use_fuzzy_matching', None) + self.highlight_post_tag = kwargs.get('highlight_post_tag', None) + self.highlight_pre_tag = kwargs.get('highlight_pre_tag', None) + self.minimum_coverage = kwargs.get('minimum_coverage', None) + self.order_by = kwargs.get('order_by', None) + self.search_fields = kwargs.get('search_fields', None) + self.select = kwargs.get('select', None) + self.top = kwargs.get('top', None) class SuggestRequest(msrest.serialization.Model): @@ -1039,37 +1090,40 @@ class SuggestRequest(msrest.serialization.Model): """ _validation = { - "search_text": {"required": True}, - "suggester_name": {"required": True}, + 'search_text': {'required': True}, + 'suggester_name': {'required': True}, } _attribute_map = { - "filter": {"key": "filter", "type": "str"}, - "use_fuzzy_matching": {"key": "fuzzy", "type": "bool"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "order_by": {"key": "orderby", "type": "str"}, - "search_text": {"key": "search", "type": "str"}, - "search_fields": {"key": "searchFields", "type": "str"}, - "select": {"key": "select", "type": "str"}, - "suggester_name": {"key": "suggesterName", "type": "str"}, - "top": {"key": "top", "type": "int"}, + 'filter': {'key': 'filter', 'type': 'str'}, + 'use_fuzzy_matching': {'key': 'fuzzy', 'type': 'bool'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'order_by': {'key': 'orderby', 'type': 'str'}, + 'search_text': {'key': 'search', 'type': 'str'}, + 'search_fields': {'key': 'searchFields', 'type': 'str'}, + 'select': {'key': 'select', 'type': 'str'}, + 'suggester_name': {'key': 'suggesterName', 'type': 'str'}, + 'top': {'key': 'top', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SuggestRequest, self).__init__(**kwargs) - self.filter = kwargs.get("filter", None) - self.use_fuzzy_matching = kwargs.get("use_fuzzy_matching", None) - self.highlight_post_tag = kwargs.get("highlight_post_tag", None) - self.highlight_pre_tag = kwargs.get("highlight_pre_tag", None) - self.minimum_coverage = kwargs.get("minimum_coverage", None) - self.order_by = kwargs.get("order_by", None) - self.search_text = kwargs["search_text"] - self.search_fields = kwargs.get("search_fields", None) - self.select = kwargs.get("select", None) - self.suggester_name = kwargs["suggester_name"] - self.top = kwargs.get("top", None) + self.filter = kwargs.get('filter', None) + self.use_fuzzy_matching = kwargs.get('use_fuzzy_matching', None) + self.highlight_post_tag = kwargs.get('highlight_post_tag', None) + self.highlight_pre_tag = kwargs.get('highlight_pre_tag', None) + self.minimum_coverage = kwargs.get('minimum_coverage', None) + self.order_by = kwargs.get('order_by', None) + self.search_text = kwargs['search_text'] + self.search_fields = kwargs.get('search_fields', None) + self.select = kwargs.get('select', None) + self.suggester_name = kwargs['suggester_name'] + self.top = kwargs.get('top', None) class SuggestResult(msrest.serialization.Model): @@ -1087,15 +1141,18 @@ class SuggestResult(msrest.serialization.Model): """ _validation = { - "text": {"required": True, "readonly": True}, + 'text': {'required': True, 'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "text": {"key": "@search\\.text", "type": "str"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'text': {'key': '@search\\.text', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SuggestResult, self).__init__(**kwargs) - self.additional_properties = kwargs.get("additional_properties", None) + self.additional_properties = kwargs.get('additional_properties', None) self.text = None diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_models_py3.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_models_py3.py index 44711fdc9cbb..033a095dc8f1 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_models_py3.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_models_py3.py @@ -35,22 +35,25 @@ class AnswerResult(msrest.serialization.Model): """ _validation = { - "score": {"readonly": True}, - "key": {"readonly": True}, - "text": {"readonly": True}, - "highlights": {"readonly": True}, + 'score': {'readonly': True}, + 'key': {'readonly': True}, + 'text': {'readonly': True}, + 'highlights': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "score": {"key": "score", "type": "float"}, - "key": {"key": "key", "type": "str"}, - "text": {"key": "text", "type": "str"}, - "highlights": {"key": "highlights", "type": "str"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'score': {'key': 'score', 'type': 'float'}, + 'key': {'key': 'key', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'highlights': {'key': 'highlights', 'type': 'str'}, } def __init__( - self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + **kwargs ): super(AnswerResult, self).__init__(**kwargs) self.additional_properties = additional_properties @@ -74,16 +77,19 @@ class AutocompleteItem(msrest.serialization.Model): """ _validation = { - "text": {"required": True, "readonly": True}, - "query_plus_text": {"required": True, "readonly": True}, + 'text': {'required': True, 'readonly': True}, + 'query_plus_text': {'required': True, 'readonly': True}, } _attribute_map = { - "text": {"key": "text", "type": "str"}, - "query_plus_text": {"key": "queryPlusText", "type": "str"}, + 'text': {'key': 'text', 'type': 'str'}, + 'query_plus_text': {'key': 'queryPlusText', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutocompleteItem, self).__init__(**kwargs) self.text = None self.query_plus_text = None @@ -125,14 +131,14 @@ class AutocompleteOptions(msrest.serialization.Model): """ _attribute_map = { - "autocomplete_mode": {"key": "autocompleteMode", "type": "str"}, - "filter": {"key": "$filter", "type": "str"}, - "use_fuzzy_matching": {"key": "UseFuzzyMatching", "type": "bool"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "search_fields": {"key": "searchFields", "type": "[str]"}, - "top": {"key": "$top", "type": "int"}, + 'autocomplete_mode': {'key': 'autocompleteMode', 'type': 'str'}, + 'filter': {'key': '$filter', 'type': 'str'}, + 'use_fuzzy_matching': {'key': 'UseFuzzyMatching', 'type': 'bool'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'search_fields': {'key': 'searchFields', 'type': '[str]'}, + 'top': {'key': '$top', 'type': 'int'}, } def __init__( @@ -202,21 +208,21 @@ class AutocompleteRequest(msrest.serialization.Model): """ _validation = { - "search_text": {"required": True}, - "suggester_name": {"required": True}, + 'search_text': {'required': True}, + 'suggester_name': {'required': True}, } _attribute_map = { - "search_text": {"key": "search", "type": "str"}, - "autocomplete_mode": {"key": "autocompleteMode", "type": "str"}, - "filter": {"key": "filter", "type": "str"}, - "use_fuzzy_matching": {"key": "fuzzy", "type": "bool"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "search_fields": {"key": "searchFields", "type": "str"}, - "suggester_name": {"key": "suggesterName", "type": "str"}, - "top": {"key": "top", "type": "int"}, + 'search_text': {'key': 'search', 'type': 'str'}, + 'autocomplete_mode': {'key': 'autocompleteMode', 'type': 'str'}, + 'filter': {'key': 'filter', 'type': 'str'}, + 'use_fuzzy_matching': {'key': 'fuzzy', 'type': 'bool'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'search_fields': {'key': 'searchFields', 'type': 'str'}, + 'suggester_name': {'key': 'suggesterName', 'type': 'str'}, + 'top': {'key': 'top', 'type': 'int'}, } def __init__( @@ -262,16 +268,19 @@ class AutocompleteResult(msrest.serialization.Model): """ _validation = { - "coverage": {"readonly": True}, - "results": {"required": True, "readonly": True}, + 'coverage': {'readonly': True}, + 'results': {'required': True, 'readonly': True}, } _attribute_map = { - "coverage": {"key": "@search\\.coverage", "type": "float"}, - "results": {"key": "value", "type": "[AutocompleteItem]"}, + 'coverage': {'key': '@search\\.coverage', 'type': 'float'}, + 'results': {'key': 'value', 'type': '[AutocompleteItem]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AutocompleteResult, self).__init__(**kwargs) self.coverage = None self.results = None @@ -294,18 +303,21 @@ class CaptionResult(msrest.serialization.Model): """ _validation = { - "text": {"readonly": True}, - "highlights": {"readonly": True}, + 'text': {'readonly': True}, + 'highlights': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "text": {"key": "text", "type": "str"}, - "highlights": {"key": "highlights", "type": "str"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'text': {'key': 'text', 'type': 'str'}, + 'highlights': {'key': 'highlights', 'type': 'str'}, } def __init__( - self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + **kwargs ): super(CaptionResult, self).__init__(**kwargs) self.additional_properties = additional_properties @@ -327,16 +339,19 @@ class FacetResult(msrest.serialization.Model): """ _validation = { - "count": {"readonly": True}, + 'count': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "count": {"key": "count", "type": "long"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'count': {'key': 'count', 'type': 'long'}, } def __init__( - self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + **kwargs ): super(FacetResult, self).__init__(**kwargs) self.additional_properties = additional_properties @@ -355,8 +370,8 @@ class IndexAction(msrest.serialization.Model): """ _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "action_type": {"key": "@search\\.action", "type": "str"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'action_type': {'key': '@search\\.action', 'type': 'str'}, } def __init__( @@ -381,14 +396,19 @@ class IndexBatch(msrest.serialization.Model): """ _validation = { - "actions": {"required": True}, + 'actions': {'required': True}, } _attribute_map = { - "actions": {"key": "value", "type": "[IndexAction]"}, + 'actions': {'key': 'value', 'type': '[IndexAction]'}, } - def __init__(self, *, actions: List["IndexAction"], **kwargs): + def __init__( + self, + *, + actions: List["IndexAction"], + **kwargs + ): super(IndexBatch, self).__init__(**kwargs) self.actions = actions @@ -406,14 +426,17 @@ class IndexDocumentsResult(msrest.serialization.Model): """ _validation = { - "results": {"required": True, "readonly": True}, + 'results': {'required': True, 'readonly': True}, } _attribute_map = { - "results": {"key": "value", "type": "[IndexingResult]"}, + 'results': {'key': 'value', 'type': '[IndexingResult]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IndexDocumentsResult, self).__init__(**kwargs) self.results = None @@ -441,20 +464,23 @@ class IndexingResult(msrest.serialization.Model): """ _validation = { - "key": {"required": True, "readonly": True}, - "error_message": {"readonly": True}, - "succeeded": {"required": True, "readonly": True}, - "status_code": {"required": True, "readonly": True}, + 'key': {'required': True, 'readonly': True}, + 'error_message': {'readonly': True}, + 'succeeded': {'required': True, 'readonly': True}, + 'status_code': {'required': True, 'readonly': True}, } _attribute_map = { - "key": {"key": "key", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - "succeeded": {"key": "status", "type": "bool"}, - "status_code": {"key": "statusCode", "type": "int"}, + 'key': {'key': 'key', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + 'succeeded': {'key': 'status', 'type': 'bool'}, + 'status_code': {'key': 'statusCode', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IndexingResult, self).__init__(**kwargs) self.key = None self.error_message = None @@ -470,10 +496,15 @@ class RequestOptions(msrest.serialization.Model): """ _attribute_map = { - "x_ms_client_request_id": {"key": "x-ms-client-request-id", "type": "str"}, + 'x_ms_client_request_id': {'key': 'x-ms-client-request-id', 'type': 'str'}, } - def __init__(self, *, x_ms_client_request_id: Optional[str] = None, **kwargs): + def __init__( + self, + *, + x_ms_client_request_id: Optional[str] = None, + **kwargs + ): super(RequestOptions, self).__init__(**kwargs) self.x_ms_client_request_id = x_ms_client_request_id @@ -514,29 +545,29 @@ class SearchDocumentsResult(msrest.serialization.Model): """ _validation = { - "count": {"readonly": True}, - "coverage": {"readonly": True}, - "facets": {"readonly": True}, - "answers": {"readonly": True}, - "next_page_parameters": {"readonly": True}, - "results": {"required": True, "readonly": True}, - "next_link": {"readonly": True}, + 'count': {'readonly': True}, + 'coverage': {'readonly': True}, + 'facets': {'readonly': True}, + 'answers': {'readonly': True}, + 'next_page_parameters': {'readonly': True}, + 'results': {'required': True, 'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - "count": {"key": "@odata\\.count", "type": "long"}, - "coverage": {"key": "@search\\.coverage", "type": "float"}, - "facets": {"key": "@search\\.facets", "type": "{[FacetResult]}"}, - "answers": {"key": "@search\\.answers", "type": "[AnswerResult]"}, - "next_page_parameters": { - "key": "@search\\.nextPageParameters", - "type": "SearchRequest", - }, - "results": {"key": "value", "type": "[SearchResult]"}, - "next_link": {"key": "@odata\\.nextLink", "type": "str"}, + 'count': {'key': '@odata\\.count', 'type': 'long'}, + 'coverage': {'key': '@search\\.coverage', 'type': 'float'}, + 'facets': {'key': '@search\\.facets', 'type': '{[FacetResult]}'}, + 'answers': {'key': '@search\\.answers', 'type': '[AnswerResult]'}, + 'next_page_parameters': {'key': '@search\\.nextPageParameters', 'type': 'SearchRequest'}, + 'results': {'key': 'value', 'type': '[SearchResult]'}, + 'next_link': {'key': '@odata\\.nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SearchDocumentsResult, self).__init__(**kwargs) self.count = None self.coverage = None @@ -563,18 +594,21 @@ class SearchError(msrest.serialization.Model): """ _validation = { - "code": {"readonly": True}, - "message": {"required": True, "readonly": True}, - "details": {"readonly": True}, + 'code': {'readonly': True}, + 'message': {'required': True, 'readonly': True}, + 'details': {'readonly': True}, } _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[SearchError]"}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[SearchError]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SearchError, self).__init__(**kwargs) self.code = None self.message = None @@ -679,32 +713,29 @@ class SearchOptions(msrest.serialization.Model): """ _attribute_map = { - "include_total_result_count": { - "key": "IncludeTotalResultCount", - "type": "bool", - }, - "facets": {"key": "Facets", "type": "[str]"}, - "filter": {"key": "$filter", "type": "str"}, - "highlight_fields": {"key": "HighlightFields", "type": "[str]"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "order_by": {"key": "OrderBy", "type": "[str]"}, - "query_type": {"key": "queryType", "type": "str"}, - "scoring_parameters": {"key": "ScoringParameters", "type": "[str]"}, - "scoring_profile": {"key": "scoringProfile", "type": "str"}, - "search_fields": {"key": "searchFields", "type": "[str]"}, - "query_language": {"key": "queryLanguage", "type": "str"}, - "speller": {"key": "speller", "type": "str"}, - "answers": {"key": "answers", "type": "str"}, - "search_mode": {"key": "searchMode", "type": "str"}, - "scoring_statistics": {"key": "scoringStatistics", "type": "str"}, - "session_id": {"key": "sessionId", "type": "str"}, - "select": {"key": "$select", "type": "[str]"}, - "skip": {"key": "$skip", "type": "int"}, - "top": {"key": "$top", "type": "int"}, - "captions": {"key": "captions", "type": "str"}, - "semantic_fields": {"key": "semanticFields", "type": "[str]"}, + 'include_total_result_count': {'key': 'IncludeTotalResultCount', 'type': 'bool'}, + 'facets': {'key': 'Facets', 'type': '[str]'}, + 'filter': {'key': '$filter', 'type': 'str'}, + 'highlight_fields': {'key': 'HighlightFields', 'type': '[str]'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'order_by': {'key': 'OrderBy', 'type': '[str]'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + 'scoring_parameters': {'key': 'ScoringParameters', 'type': '[str]'}, + 'scoring_profile': {'key': 'scoringProfile', 'type': 'str'}, + 'search_fields': {'key': 'searchFields', 'type': '[str]'}, + 'query_language': {'key': 'queryLanguage', 'type': 'str'}, + 'speller': {'key': 'speller', 'type': 'str'}, + 'answers': {'key': 'answers', 'type': 'str'}, + 'search_mode': {'key': 'searchMode', 'type': 'str'}, + 'scoring_statistics': {'key': 'scoringStatistics', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'select': {'key': '$select', 'type': '[str]'}, + 'skip': {'key': '$skip', 'type': 'int'}, + 'top': {'key': '$top', 'type': 'int'}, + 'captions': {'key': 'captions', 'type': 'str'}, + 'semantic_fields': {'key': 'semanticFields', 'type': '[str]'}, } def __init__( @@ -860,30 +891,30 @@ class SearchRequest(msrest.serialization.Model): """ _attribute_map = { - "include_total_result_count": {"key": "count", "type": "bool"}, - "facets": {"key": "facets", "type": "[str]"}, - "filter": {"key": "filter", "type": "str"}, - "highlight_fields": {"key": "highlight", "type": "str"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "order_by": {"key": "orderby", "type": "str"}, - "query_type": {"key": "queryType", "type": "str"}, - "scoring_statistics": {"key": "scoringStatistics", "type": "str"}, - "session_id": {"key": "sessionId", "type": "str"}, - "scoring_parameters": {"key": "scoringParameters", "type": "[str]"}, - "scoring_profile": {"key": "scoringProfile", "type": "str"}, - "search_text": {"key": "search", "type": "str"}, - "search_fields": {"key": "searchFields", "type": "str"}, - "search_mode": {"key": "searchMode", "type": "str"}, - "query_language": {"key": "queryLanguage", "type": "str"}, - "speller": {"key": "speller", "type": "str"}, - "answers": {"key": "answers", "type": "str"}, - "select": {"key": "select", "type": "str"}, - "skip": {"key": "skip", "type": "int"}, - "top": {"key": "top", "type": "int"}, - "captions": {"key": "captions", "type": "str"}, - "semantic_fields": {"key": "semanticFields", "type": "str"}, + 'include_total_result_count': {'key': 'count', 'type': 'bool'}, + 'facets': {'key': 'facets', 'type': '[str]'}, + 'filter': {'key': 'filter', 'type': 'str'}, + 'highlight_fields': {'key': 'highlight', 'type': 'str'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'order_by': {'key': 'orderby', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + 'scoring_statistics': {'key': 'scoringStatistics', 'type': 'str'}, + 'session_id': {'key': 'sessionId', 'type': 'str'}, + 'scoring_parameters': {'key': 'scoringParameters', 'type': '[str]'}, + 'scoring_profile': {'key': 'scoringProfile', 'type': 'str'}, + 'search_text': {'key': 'search', 'type': 'str'}, + 'search_fields': {'key': 'searchFields', 'type': 'str'}, + 'search_mode': {'key': 'searchMode', 'type': 'str'}, + 'query_language': {'key': 'queryLanguage', 'type': 'str'}, + 'speller': {'key': 'speller', 'type': 'str'}, + 'answers': {'key': 'answers', 'type': 'str'}, + 'select': {'key': 'select', 'type': 'str'}, + 'skip': {'key': 'skip', 'type': 'int'}, + 'top': {'key': 'top', 'type': 'int'}, + 'captions': {'key': 'captions', 'type': 'str'}, + 'semantic_fields': {'key': 'semanticFields', 'type': 'str'}, } def __init__( @@ -969,22 +1000,25 @@ class SearchResult(msrest.serialization.Model): """ _validation = { - "score": {"required": True, "readonly": True}, - "reranker_score": {"readonly": True}, - "highlights": {"readonly": True}, - "captions": {"readonly": True}, + 'score': {'required': True, 'readonly': True}, + 'reranker_score': {'readonly': True}, + 'highlights': {'readonly': True}, + 'captions': {'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "score": {"key": "@search\\.score", "type": "float"}, - "reranker_score": {"key": "@search\\.rerankerScore", "type": "float"}, - "highlights": {"key": "@search\\.highlights", "type": "{[str]}"}, - "captions": {"key": "@search\\.captions", "type": "[CaptionResult]"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'score': {'key': '@search\\.score', 'type': 'float'}, + 'reranker_score': {'key': '@search\\.rerankerScore', 'type': 'float'}, + 'highlights': {'key': '@search\\.highlights', 'type': '{[str]}'}, + 'captions': {'key': '@search\\.captions', 'type': '[CaptionResult]'}, } def __init__( - self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + **kwargs ): super(SearchResult, self).__init__(**kwargs) self.additional_properties = additional_properties @@ -1009,16 +1043,19 @@ class SuggestDocumentsResult(msrest.serialization.Model): """ _validation = { - "results": {"required": True, "readonly": True}, - "coverage": {"readonly": True}, + 'results': {'required': True, 'readonly': True}, + 'coverage': {'readonly': True}, } _attribute_map = { - "results": {"key": "value", "type": "[SuggestResult]"}, - "coverage": {"key": "@search\\.coverage", "type": "float"}, + 'results': {'key': 'value', 'type': '[SuggestResult]'}, + 'coverage': {'key': '@search\\.coverage', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SuggestDocumentsResult, self).__init__(**kwargs) self.results = None self.coverage = None @@ -1065,15 +1102,15 @@ class SuggestOptions(msrest.serialization.Model): """ _attribute_map = { - "filter": {"key": "$filter", "type": "str"}, - "use_fuzzy_matching": {"key": "UseFuzzyMatching", "type": "bool"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "order_by": {"key": "OrderBy", "type": "[str]"}, - "search_fields": {"key": "searchFields", "type": "[str]"}, - "select": {"key": "$select", "type": "[str]"}, - "top": {"key": "$top", "type": "int"}, + 'filter': {'key': '$filter', 'type': 'str'}, + 'use_fuzzy_matching': {'key': 'UseFuzzyMatching', 'type': 'bool'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'order_by': {'key': 'OrderBy', 'type': '[str]'}, + 'search_fields': {'key': 'searchFields', 'type': '[str]'}, + 'select': {'key': '$select', 'type': '[str]'}, + 'top': {'key': '$top', 'type': 'int'}, } def __init__( @@ -1151,22 +1188,22 @@ class SuggestRequest(msrest.serialization.Model): """ _validation = { - "search_text": {"required": True}, - "suggester_name": {"required": True}, + 'search_text': {'required': True}, + 'suggester_name': {'required': True}, } _attribute_map = { - "filter": {"key": "filter", "type": "str"}, - "use_fuzzy_matching": {"key": "fuzzy", "type": "bool"}, - "highlight_post_tag": {"key": "highlightPostTag", "type": "str"}, - "highlight_pre_tag": {"key": "highlightPreTag", "type": "str"}, - "minimum_coverage": {"key": "minimumCoverage", "type": "float"}, - "order_by": {"key": "orderby", "type": "str"}, - "search_text": {"key": "search", "type": "str"}, - "search_fields": {"key": "searchFields", "type": "str"}, - "select": {"key": "select", "type": "str"}, - "suggester_name": {"key": "suggesterName", "type": "str"}, - "top": {"key": "top", "type": "int"}, + 'filter': {'key': 'filter', 'type': 'str'}, + 'use_fuzzy_matching': {'key': 'fuzzy', 'type': 'bool'}, + 'highlight_post_tag': {'key': 'highlightPostTag', 'type': 'str'}, + 'highlight_pre_tag': {'key': 'highlightPreTag', 'type': 'str'}, + 'minimum_coverage': {'key': 'minimumCoverage', 'type': 'float'}, + 'order_by': {'key': 'orderby', 'type': 'str'}, + 'search_text': {'key': 'search', 'type': 'str'}, + 'search_fields': {'key': 'searchFields', 'type': 'str'}, + 'select': {'key': 'select', 'type': 'str'}, + 'suggester_name': {'key': 'suggesterName', 'type': 'str'}, + 'top': {'key': 'top', 'type': 'int'}, } def __init__( @@ -1214,16 +1251,19 @@ class SuggestResult(msrest.serialization.Model): """ _validation = { - "text": {"required": True, "readonly": True}, + 'text': {'required': True, 'readonly': True}, } _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "text": {"key": "@search\\.text", "type": "str"}, + 'additional_properties': {'key': '', 'type': '{object}'}, + 'text': {'key': '@search\\.text', 'type': 'str'}, } def __init__( - self, *, additional_properties: Optional[Dict[str, Any]] = None, **kwargs + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + **kwargs ): super(SuggestResult, self).__init__(**kwargs) self.additional_properties = additional_properties diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_search_client_enums.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_search_client_enums.py index ae3ba07621bf..c49117818f8e 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_search_client_enums.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/models/_search_client_enums.py @@ -9,7 +9,6 @@ from enum import Enum, EnumMeta from six import with_metaclass - class _CaseInsensitiveEnumMeta(EnumMeta): def __getitem__(self, name): return super().__getitem__(name.upper()) @@ -41,7 +40,6 @@ class Answers(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: expressed as a question in natural language. EXTRACTIVE = "extractive" - class AutocompleteMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles and 'oneTermWithContext' to use the current context in producing autocomplete terms. @@ -59,7 +57,6 @@ class AutocompleteMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: terms could include 'washington medicaid' and 'washington medical'. ONE_TERM_WITH_CONTEXT = "oneTermWithContext" - class Captions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """This parameter is only valid if the query type is 'semantic'. If set, the query returns captions extracted from key passages in the highest ranked documents. When Captions is set to @@ -74,9 +71,9 @@ class Captions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: query. EXTRACTIVE = "extractive" - class IndexActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The operation to perform on a document in an indexing batch.""" + """The operation to perform on a document in an indexing batch. + """ #: Inserts the document into the index if it is new and updates it if it exists. All fields are #: replaced in the update case. @@ -93,16 +90,15 @@ class IndexActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: document, use merge instead and set the field explicitly to null. DELETE = "delete" - class QueryLanguage(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The language of the query.""" + """The language of the query. + """ #: Query language not specified. NONE = "none" #: English. EN_US = "en-us" - class QueryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query syntax and 'semantic' if query syntax is not needed. @@ -121,7 +117,6 @@ class QueryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: on the Web corpus. SEMANTIC = "semantic" - class ScoringStatistics(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for more consistent scoring, or locally, for lower latency. The default is @@ -134,7 +129,6 @@ class ScoringStatistics(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The scoring statistics will be calculated globally for more consistent scoring. GLOBAL_ENUM = "global" - class SearchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether any or all of the search terms must be matched in order to count the document as a match. @@ -145,9 +139,9 @@ class SearchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: All of the search terms must be matched in order to count the document as a match. ALL = "all" - class Speller(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Improve search recall by spell-correcting individual search query terms.""" + """Improve search recall by spell-correcting individual search query terms. + """ #: Speller not enabled. NONE = "none" diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/operations/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/operations/__init__.py index b0e711ee0870..76022eb9d305 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/operations/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/operations/__init__.py @@ -9,5 +9,5 @@ from ._documents_operations import DocumentsOperations __all__ = [ - "DocumentsOperations", + 'DocumentsOperations', ] diff --git a/sdk/search/azure-search-documents/azure/search/documents/_generated/operations/_documents_operations.py b/sdk/search/azure-search-documents/azure/search/documents/_generated/operations/_documents_operations.py index 7891f4269cab..9a2c4cda4ee8 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_generated/operations/_documents_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_generated/operations/_documents_operations.py @@ -8,13 +8,7 @@ from typing import TYPE_CHECKING import warnings -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse @@ -24,11 +18,8 @@ # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - T = TypeVar("T") - ClsType = Optional[ - Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any] - ] - + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DocumentsOperations(object): """DocumentsOperations operations. @@ -67,14 +58,12 @@ def count( :rtype: long :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[int] + cls = kwargs.pop('cls', None) # type: ClsType[int] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -82,52 +71,39 @@ def count( accept = "application/json" # Construct URL - url = self.count.metadata["url"] # type: ignore + url = self.count.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("long", pipeline_response) + deserialized = self._deserialize('long', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - count.metadata = {"url": "/docs/$count"} # type: ignore + count.metadata = {'url': '/docs/$count'} # type: ignore def search_get( self, @@ -151,14 +127,12 @@ def search_get( :rtype: ~azure.search.documents.models.SearchDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SearchDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _include_total_result_count = None _facets = None _filter = None @@ -213,148 +187,87 @@ def search_get( accept = "application/json" # Construct URL - url = self.search_get.metadata["url"] # type: ignore + url = self.search_get.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] if search_text is not None: - query_parameters["search"] = self._serialize.query( - "search_text", search_text, "str" - ) + query_parameters['search'] = self._serialize.query("search_text", search_text, 'str') if _include_total_result_count is not None: - query_parameters["$count"] = self._serialize.query( - "include_total_result_count", _include_total_result_count, "bool" - ) + query_parameters['$count'] = self._serialize.query("include_total_result_count", _include_total_result_count, 'bool') if _facets is not None: - query_parameters["facet"] = [ - self._serialize.query("facets", q, "str") if q is not None else "" - for q in _facets - ] + query_parameters['facet'] = [self._serialize.query("facets", q, 'str') if q is not None else '' for q in _facets] if _filter is not None: - query_parameters["$filter"] = self._serialize.query( - "filter", _filter, "str" - ) + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') if _highlight_fields is not None: - query_parameters["highlight"] = self._serialize.query( - "highlight_fields", _highlight_fields, "[str]", div="," - ) + query_parameters['highlight'] = self._serialize.query("highlight_fields", _highlight_fields, '[str]', div=',') if _highlight_post_tag is not None: - query_parameters["highlightPostTag"] = self._serialize.query( - "highlight_post_tag", _highlight_post_tag, "str" - ) + query_parameters['highlightPostTag'] = self._serialize.query("highlight_post_tag", _highlight_post_tag, 'str') if _highlight_pre_tag is not None: - query_parameters["highlightPreTag"] = self._serialize.query( - "highlight_pre_tag", _highlight_pre_tag, "str" - ) + query_parameters['highlightPreTag'] = self._serialize.query("highlight_pre_tag", _highlight_pre_tag, 'str') if _minimum_coverage is not None: - query_parameters["minimumCoverage"] = self._serialize.query( - "minimum_coverage", _minimum_coverage, "float" - ) + query_parameters['minimumCoverage'] = self._serialize.query("minimum_coverage", _minimum_coverage, 'float') if _order_by is not None: - query_parameters["$orderby"] = self._serialize.query( - "order_by", _order_by, "[str]", div="," - ) + query_parameters['$orderby'] = self._serialize.query("order_by", _order_by, '[str]', div=',') if _query_type is not None: - query_parameters["queryType"] = self._serialize.query( - "query_type", _query_type, "str" - ) + query_parameters['queryType'] = self._serialize.query("query_type", _query_type, 'str') if _scoring_parameters is not None: - query_parameters["scoringParameter"] = [ - self._serialize.query("scoring_parameters", q, "str") - if q is not None - else "" - for q in _scoring_parameters - ] + query_parameters['scoringParameter'] = [self._serialize.query("scoring_parameters", q, 'str') if q is not None else '' for q in _scoring_parameters] if _scoring_profile is not None: - query_parameters["scoringProfile"] = self._serialize.query( - "scoring_profile", _scoring_profile, "str" - ) + query_parameters['scoringProfile'] = self._serialize.query("scoring_profile", _scoring_profile, 'str') if _search_fields is not None: - query_parameters["searchFields"] = self._serialize.query( - "search_fields", _search_fields, "[str]", div="," - ) + query_parameters['searchFields'] = self._serialize.query("search_fields", _search_fields, '[str]', div=',') if _query_language is not None: - query_parameters["queryLanguage"] = self._serialize.query( - "query_language", _query_language, "str" - ) + query_parameters['queryLanguage'] = self._serialize.query("query_language", _query_language, 'str') if _speller is not None: - query_parameters["speller"] = self._serialize.query( - "speller", _speller, "str" - ) + query_parameters['speller'] = self._serialize.query("speller", _speller, 'str') if _answers is not None: - query_parameters["answers"] = self._serialize.query( - "answers", _answers, "str" - ) + query_parameters['answers'] = self._serialize.query("answers", _answers, 'str') if _search_mode is not None: - query_parameters["searchMode"] = self._serialize.query( - "search_mode", _search_mode, "str" - ) + query_parameters['searchMode'] = self._serialize.query("search_mode", _search_mode, 'str') if _scoring_statistics is not None: - query_parameters["scoringStatistics"] = self._serialize.query( - "scoring_statistics", _scoring_statistics, "str" - ) + query_parameters['scoringStatistics'] = self._serialize.query("scoring_statistics", _scoring_statistics, 'str') if _session_id is not None: - query_parameters["sessionId"] = self._serialize.query( - "session_id", _session_id, "str" - ) + query_parameters['sessionId'] = self._serialize.query("session_id", _session_id, 'str') if _select is not None: - query_parameters["$select"] = self._serialize.query( - "select", _select, "[str]", div="," - ) + query_parameters['$select'] = self._serialize.query("select", _select, '[str]', div=',') if _skip is not None: - query_parameters["$skip"] = self._serialize.query("skip", _skip, "int") + query_parameters['$skip'] = self._serialize.query("skip", _skip, 'int') if _top is not None: - query_parameters["$top"] = self._serialize.query("top", _top, "int") + query_parameters['$top'] = self._serialize.query("top", _top, 'int') if _captions is not None: - query_parameters["captions"] = self._serialize.query( - "captions", _captions, "str" - ) + query_parameters['captions'] = self._serialize.query("captions", _captions, 'str') if _semantic_fields is not None: - query_parameters["semanticFields"] = self._serialize.query( - "semantic_fields", _semantic_fields, "[str]", div="," - ) - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['semanticFields'] = self._serialize.query("semantic_fields", _semantic_fields, '[str]', div=',') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SearchDocumentsResult", pipeline_response) + deserialized = self._deserialize('SearchDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - search_get.metadata = {"url": "/docs"} # type: ignore + search_get.metadata = {'url': '/docs'} # type: ignore def search_post( self, @@ -374,14 +287,12 @@ def search_post( :rtype: ~azure.search.documents.models.SearchDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SearchDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -390,60 +301,43 @@ def search_post( accept = "application/json" # Construct URL - url = self.search_post.metadata["url"] # type: ignore + url = self.search_post.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Content-Type"] = self._serialize.header( - "content_type", content_type, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(search_request, "SearchRequest") - body_content_kwargs["content"] = body_content - request = self._client.post( - url, query_parameters, header_parameters, **body_content_kwargs - ) + body_content = self._serialize.body(search_request, 'SearchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SearchDocumentsResult", pipeline_response) + deserialized = self._deserialize('SearchDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - search_post.metadata = {"url": "/docs/search.post.search"} # type: ignore + search_post.metadata = {'url': '/docs/search.post.search'} # type: ignore def get( self, @@ -467,14 +361,12 @@ def get( :rtype: any :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType[Any] + cls = kwargs.pop('cls', None) # type: ClsType[Any] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -482,57 +374,42 @@ def get( accept = "application/json" # Construct URL - url = self.get.metadata["url"] # type: ignore + url = self.get.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), - "key": self._serialize.url("key", key, "str"), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), + 'key': self._serialize.url("key", key, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] if selected_fields is not None: - query_parameters["$select"] = self._serialize.query( - "selected_fields", selected_fields, "[str]", div="," - ) - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['$select'] = self._serialize.query("selected_fields", selected_fields, '[str]', div=',') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("object", pipeline_response) + deserialized = self._deserialize('object', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {"url": "/docs('{key}')"} # type: ignore + get.metadata = {'url': '/docs(\'{key}\')'} # type: ignore def suggest_get( self, @@ -560,14 +437,12 @@ def suggest_get( :rtype: ~azure.search.documents.models.SuggestDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SuggestDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SuggestDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _filter = None _use_fuzzy_matching = None _highlight_post_tag = None @@ -594,92 +469,59 @@ def suggest_get( accept = "application/json" # Construct URL - url = self.suggest_get.metadata["url"] # type: ignore + url = self.suggest_get.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["search"] = self._serialize.query( - "search_text", search_text, "str" - ) - query_parameters["suggesterName"] = self._serialize.query( - "suggester_name", suggester_name, "str" - ) + query_parameters['search'] = self._serialize.query("search_text", search_text, 'str') + query_parameters['suggesterName'] = self._serialize.query("suggester_name", suggester_name, 'str') if _filter is not None: - query_parameters["$filter"] = self._serialize.query( - "filter", _filter, "str" - ) + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') if _use_fuzzy_matching is not None: - query_parameters["fuzzy"] = self._serialize.query( - "use_fuzzy_matching", _use_fuzzy_matching, "bool" - ) + query_parameters['fuzzy'] = self._serialize.query("use_fuzzy_matching", _use_fuzzy_matching, 'bool') if _highlight_post_tag is not None: - query_parameters["highlightPostTag"] = self._serialize.query( - "highlight_post_tag", _highlight_post_tag, "str" - ) + query_parameters['highlightPostTag'] = self._serialize.query("highlight_post_tag", _highlight_post_tag, 'str') if _highlight_pre_tag is not None: - query_parameters["highlightPreTag"] = self._serialize.query( - "highlight_pre_tag", _highlight_pre_tag, "str" - ) + query_parameters['highlightPreTag'] = self._serialize.query("highlight_pre_tag", _highlight_pre_tag, 'str') if _minimum_coverage is not None: - query_parameters["minimumCoverage"] = self._serialize.query( - "minimum_coverage", _minimum_coverage, "float" - ) + query_parameters['minimumCoverage'] = self._serialize.query("minimum_coverage", _minimum_coverage, 'float') if _order_by is not None: - query_parameters["$orderby"] = self._serialize.query( - "order_by", _order_by, "[str]", div="," - ) + query_parameters['$orderby'] = self._serialize.query("order_by", _order_by, '[str]', div=',') if _search_fields is not None: - query_parameters["searchFields"] = self._serialize.query( - "search_fields", _search_fields, "[str]", div="," - ) + query_parameters['searchFields'] = self._serialize.query("search_fields", _search_fields, '[str]', div=',') if _select is not None: - query_parameters["$select"] = self._serialize.query( - "select", _select, "[str]", div="," - ) + query_parameters['$select'] = self._serialize.query("select", _select, '[str]', div=',') if _top is not None: - query_parameters["$top"] = self._serialize.query("top", _top, "int") - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['$top'] = self._serialize.query("top", _top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SuggestDocumentsResult", pipeline_response) + deserialized = self._deserialize('SuggestDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - suggest_get.metadata = {"url": "/docs/search.suggest"} # type: ignore + suggest_get.metadata = {'url': '/docs/search.suggest'} # type: ignore def suggest_post( self, @@ -699,14 +541,12 @@ def suggest_post( :rtype: ~azure.search.documents.models.SuggestDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.SuggestDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SuggestDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -715,60 +555,43 @@ def suggest_post( accept = "application/json" # Construct URL - url = self.suggest_post.metadata["url"] # type: ignore + url = self.suggest_post.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Content-Type"] = self._serialize.header( - "content_type", content_type, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(suggest_request, "SuggestRequest") - body_content_kwargs["content"] = body_content - request = self._client.post( - url, query_parameters, header_parameters, **body_content_kwargs - ) + body_content = self._serialize.body(suggest_request, 'SuggestRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("SuggestDocumentsResult", pipeline_response) + deserialized = self._deserialize('SuggestDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - suggest_post.metadata = {"url": "/docs/search.post.suggest"} # type: ignore + suggest_post.metadata = {'url': '/docs/search.post.suggest'} # type: ignore def index( self, @@ -788,14 +611,12 @@ def index( :rtype: ~azure.search.documents.models.IndexDocumentsResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.IndexDocumentsResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IndexDocumentsResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -806,64 +627,47 @@ def index( accept = "application/json" # Construct URL - url = self.index.metadata["url"] # type: ignore + url = self.index.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Content-Type"] = self._serialize.header( - "content_type", content_type, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_batch, "IndexBatch") - body_content_kwargs["content"] = body_content - request = self._client.post( - url, query_parameters, header_parameters, **body_content_kwargs - ) + body_content = self._serialize.body(_batch, 'IndexBatch') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 207]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) if response.status_code == 200: - deserialized = self._deserialize("IndexDocumentsResult", pipeline_response) + deserialized = self._deserialize('IndexDocumentsResult', pipeline_response) if response.status_code == 207: - deserialized = self._deserialize("IndexDocumentsResult", pipeline_response) + deserialized = self._deserialize('IndexDocumentsResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - index.metadata = {"url": "/docs/search.index"} # type: ignore + index.metadata = {'url': '/docs/search.index'} # type: ignore def autocomplete_get( self, @@ -890,14 +694,12 @@ def autocomplete_get( :rtype: ~azure.search.documents.models.AutocompleteResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.AutocompleteResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutocompleteResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None _autocomplete_mode = None _filter = None @@ -922,88 +724,57 @@ def autocomplete_get( accept = "application/json" # Construct URL - url = self.autocomplete_get.metadata["url"] # type: ignore + url = self.autocomplete_get.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) - query_parameters["search"] = self._serialize.query( - "search_text", search_text, "str" - ) - query_parameters["suggesterName"] = self._serialize.query( - "suggester_name", suggester_name, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['search'] = self._serialize.query("search_text", search_text, 'str') + query_parameters['suggesterName'] = self._serialize.query("suggester_name", suggester_name, 'str') if _autocomplete_mode is not None: - query_parameters["autocompleteMode"] = self._serialize.query( - "autocomplete_mode", _autocomplete_mode, "str" - ) + query_parameters['autocompleteMode'] = self._serialize.query("autocomplete_mode", _autocomplete_mode, 'str') if _filter is not None: - query_parameters["$filter"] = self._serialize.query( - "filter", _filter, "str" - ) + query_parameters['$filter'] = self._serialize.query("filter", _filter, 'str') if _use_fuzzy_matching is not None: - query_parameters["fuzzy"] = self._serialize.query( - "use_fuzzy_matching", _use_fuzzy_matching, "bool" - ) + query_parameters['fuzzy'] = self._serialize.query("use_fuzzy_matching", _use_fuzzy_matching, 'bool') if _highlight_post_tag is not None: - query_parameters["highlightPostTag"] = self._serialize.query( - "highlight_post_tag", _highlight_post_tag, "str" - ) + query_parameters['highlightPostTag'] = self._serialize.query("highlight_post_tag", _highlight_post_tag, 'str') if _highlight_pre_tag is not None: - query_parameters["highlightPreTag"] = self._serialize.query( - "highlight_pre_tag", _highlight_pre_tag, "str" - ) + query_parameters['highlightPreTag'] = self._serialize.query("highlight_pre_tag", _highlight_pre_tag, 'str') if _minimum_coverage is not None: - query_parameters["minimumCoverage"] = self._serialize.query( - "minimum_coverage", _minimum_coverage, "float" - ) + query_parameters['minimumCoverage'] = self._serialize.query("minimum_coverage", _minimum_coverage, 'float') if _search_fields is not None: - query_parameters["searchFields"] = self._serialize.query( - "search_fields", _search_fields, "[str]", div="," - ) + query_parameters['searchFields'] = self._serialize.query("search_fields", _search_fields, '[str]', div=',') if _top is not None: - query_parameters["$top"] = self._serialize.query("top", _top, "int") + query_parameters['$top'] = self._serialize.query("top", _top, 'int') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("AutocompleteResult", pipeline_response) + deserialized = self._deserialize('AutocompleteResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - autocomplete_get.metadata = {"url": "/docs/search.autocomplete"} # type: ignore + autocomplete_get.metadata = {'url': '/docs/search.autocomplete'} # type: ignore def autocomplete_post( self, @@ -1023,14 +794,12 @@ def autocomplete_post( :rtype: ~azure.search.documents.models.AutocompleteResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop("cls", None) # type: ClsType["_models.AutocompleteResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AutocompleteResult"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop("error_map", {})) - + error_map.update(kwargs.pop('error_map', {})) + _x_ms_client_request_id = None if request_options is not None: _x_ms_client_request_id = request_options.x_ms_client_request_id @@ -1039,57 +808,40 @@ def autocomplete_post( accept = "application/json" # Construct URL - url = self.autocomplete_post.metadata["url"] # type: ignore + url = self.autocomplete_post.metadata['url'] # type: ignore path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - "indexName": self._serialize.url( - "self._config.index_name", self._config.index_name, "str" - ), + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'indexName': self._serialize.url("self._config.index_name", self._config.index_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} # type: Dict[str, Any] - query_parameters["api-version"] = self._serialize.query( - "api_version", api_version, "str" - ) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers header_parameters = {} # type: Dict[str, Any] if _x_ms_client_request_id is not None: - header_parameters["x-ms-client-request-id"] = self._serialize.header( - "x_ms_client_request_id", _x_ms_client_request_id, "str" - ) - header_parameters["Content-Type"] = self._serialize.header( - "content_type", content_type, "str" - ) - header_parameters["Accept"] = self._serialize.header("accept", accept, "str") + header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", _x_ms_client_request_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(autocomplete_request, "AutocompleteRequest") - body_content_kwargs["content"] = body_content - request = self._client.post( - url, query_parameters, header_parameters, **body_content_kwargs - ) + body_content = self._serialize.body(autocomplete_request, 'AutocompleteRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: - map_error( - status_code=response.status_code, response=response, error_map=error_map - ) - error = self._deserialize.failsafe_deserialize( - _models.SearchError, response - ) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.SearchError, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("AutocompleteResult", pipeline_response) + deserialized = self._deserialize('AutocompleteResult', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - - autocomplete_post.metadata = {"url": "/docs/search.post.autocomplete"} # type: ignore + autocomplete_post.metadata = {'url': '/docs/search.post.autocomplete'} # type: ignore From c490845c2b52ee05a6e706ee5029099fab5830ba Mon Sep 17 00:00:00 2001 From: Travis Prescott Date: Tue, 31 Aug 2021 15:31:03 -0700 Subject: [PATCH 3/4] Update AnalyzeTextOptions. --- .../azure/search/documents/indexes/models/_models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py index a6369bff4e77..acc61ccc75af 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py @@ -54,6 +54,9 @@ class AnalyzeTextOptions(msrest.serialization.Model): "letter", "lowercase", "microsoft_language_tokenizer", "microsoft_language_stemming_tokenizer", "nGram", "path_hierarchy_v2", "pattern", "standard_v2", "uax_url_email", "whitespace". :type tokenizer_name: str or ~azure.search.documents.indexes.models.LexicalTokenizerName + :param normalizer_name: The name of the normalizer to use to normalize the given text. Possible + values include: "asciifolding", "elision", "lowercase", "standard", "uppercase". + :type normalizer_name: str or ~azure.search.documents.indexes.models.LexicalNormalizerName :param token_filters: An optional list of token filters to use when breaking the given text. This parameter can only be set when using the tokenizer parameter. :type token_filters: list[str or ~azure.search.documents.indexes.models.TokenFilterName] @@ -70,6 +73,7 @@ class AnalyzeTextOptions(msrest.serialization.Model): "text": {"key": "text", "type": "str"}, "analyzer_name": {"key": "analyzerName", "type": "str"}, "tokenizer_name": {"key": "tokenizerName", "type": "str"}, + "normalizer_name": {"key": "normalizerName", "type": "str"}, "token_filters": {"key": "tokenFilters", "type": "[str]"}, "char_filters": {"key": "charFilters", "type": "[str]"}, } @@ -79,6 +83,7 @@ def __init__(self, **kwargs): self.text = kwargs["text"] self.analyzer_name = kwargs.get("analyzer_name", None) self.tokenizer_name = kwargs.get("tokenizer_name", None) + self.normalizer_name = kwargs.get("normalizer_name", None) self.token_filters = kwargs.get("token_filters", None) self.char_filters = kwargs.get("char_filters", None) @@ -87,6 +92,7 @@ def _to_analyze_request(self): text=self.text, analyzer=self.analyzer_name, tokenizer=self.tokenizer_name, + normalizer=self.normalizer_name, token_filters=self.token_filters, char_filters=self.char_filters, ) From 19300d90988da9495c1407bec21c406a71d205c9 Mon Sep 17 00:00:00 2001 From: Travis Prescott Date: Tue, 31 Aug 2021 15:50:46 -0700 Subject: [PATCH 4/4] Update changelog. --- sdk/search/azure-search-documents/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index 7c8df48d1e24..faba75e3685f 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -15,6 +15,7 @@ - `azure.search.documents.indexes.models.SearchIndexerDataIdentity` - `azure.search.documents.indexes.models.SearchIndexerDataNoneIdentity` - `azure.search.documents.indexes.models.SearchIndexerDataUserAssignedIdentity` +- Added `normalizer_name` property to `AnalyzeTextOptions` model. ## 11.3.0b2 (2021-08-10)