diff --git a/sdk/maps/azure-maps-search/CHANGELOG.md b/sdk/maps/azure-maps-search/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-search/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-search/LICENSE.txt b/sdk/maps/azure-maps-search/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-search/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-search/MANIFEST.in b/sdk/maps/azure-maps-search/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-search/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/maps/__init__.py +include LICENSE.txt diff --git a/sdk/maps/azure-maps-search/README.md b/sdk/maps/azure-maps-search/README.md new file mode 100644 index 000000000000..6d03aa262433 --- /dev/null +++ b/sdk/maps/azure-maps-search/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-search%2FREADME.png) diff --git a/sdk/maps/azure-maps-search/_meta.json b/sdk/maps/azure-maps-search/_meta.json new file mode 100644 index 000000000000..d008ddd2a442 --- /dev/null +++ b/sdk/maps/azure-maps-search/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "4579563bed9e107fda343d6bed7ed63953067a76", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Search/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/maps/data-plane/Search/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/azure/__init__.py b/sdk/maps/azure-maps-search/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-search/azure/maps/__init__.py b/sdk/maps/azure-maps-search/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/__init__.py new file mode 100644 index 000000000000..0697d1ca3e8a --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._search_client import SearchClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['SearchClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py b/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py new file mode 100644 index 000000000000..502f16c09817 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py @@ -0,0 +1,68 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + + +class SearchClientConfiguration(Configuration): + """Configuration for SearchClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(SearchClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-search/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + 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') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_metadata.json b/sdk/maps/azure-maps-search/azure/maps/search/_metadata.json new file mode 100644 index 000000000000..66437a23b07c --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "1.0", + "total_api_version_list": ["1.0"], + "client": { + "name": "SearchClient", + "filename": "_search_client", + "description": "Azure Maps Search REST APIs.", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"SearchClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"SearchClientConfiguration\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "client_id": { + "signature": "client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "search": "SearchOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py b/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py new file mode 100644 index 000000000000..6d9d96805220 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import SearchClientConfiguration +from .operations import SearchOperations +from . import models + + +class SearchClient(object): + """Azure Maps Search REST APIs. + + :ivar search: SearchOperations operations + :vartype search: azure.maps.search.operations.SearchOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type client_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = SearchClientConfiguration(credential, client_id, **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)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.search = SearchOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> SearchClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_version.py b/sdk/maps/azure-maps-search/azure/maps/search/_version.py new file mode 100644 index 000000000000..b9995fb385b0 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0-preview" diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py new file mode 100644 index 000000000000..ec41d54fc046 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._search_client import SearchClient +__all__ = ['SearchClient'] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py new file mode 100644 index 000000000000..3b8316242ee9 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SearchClientConfiguration(Configuration): + """Configuration for SearchClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(SearchClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-search/{}'.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') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client.py new file mode 100644 index 000000000000..8677420ee1b5 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core import AsyncPipelineClient +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import SearchClientConfiguration +from .operations import SearchOperations +from .. import models + + +class SearchClient(object): + """Azure Maps Search REST APIs. + + :ivar search: SearchOperations operations + :vartype search: azure.maps.search.aio.operations.SearchOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type client_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = SearchClientConfiguration(credential, client_id, **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)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.search = SearchOperations( + self._client, self._config, self._serialize, self._deserialize) + + 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. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + http_request.url = self._client.format_url(http_request.url) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SearchClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py new file mode 100644 index 000000000000..c7f640e252e1 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._search_operations import SearchOperations + +__all__ = [ + 'SearchOperations', +] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_search_operations.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_search_operations.py new file mode 100644 index 000000000000..e68d2c8b2e1e --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_search_operations.py @@ -0,0 +1,5257 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +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.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SearchOperations: + """SearchOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_polygon( + self, + geometry_ids: List[str], + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.PolygonResult": + """**Get Polygon** + + **Applies to**\ : S1 pricing tier. + + The Get Polygon service allows you to request the geometry data such as a city or country + outline for a set of entities, previously retrieved from an Online Search request in GeoJSON + format. The geometry ID is returned in the sourceGeometry object under "geometry" and "id" in + either a Search Address or Search Fuzzy call. + + Please note that any geometry ID retrieved from an Online Search endpoint has a limited + lifetime. The client should not store geometry IDs in persistent storage for later referral, + as the stability of these identifiers is not guaranteed for a long period of time. It is + expected that a request to the Polygon method is made within a few minutes of the request to + the Online Search method that provided the ID. The service allows for batch requests up to 20 + identifiers. + + :param geometry_ids: Comma separated list of geometry UUIDs, previously retrieved from an + Online Search request. + :type geometry_ids: list[str] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolygonResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.PolygonResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolygonResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['geometries'] = self._serialize.query("geometry_ids", geometry_ids, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PolygonResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_polygon.metadata = {'url': '/search/polygon/{format}'} # type: ignore + + async def fuzzy_search( + self, + query: str, + format: Union[str, "_models.ResponseFormat"] = "json", + is_type_ahead: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + category_filter: Optional[List[int]] = None, + country_filter: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius_in_meters: Optional[int] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + min_fuzzy_level: Optional[int] = None, + max_fuzzy_level: Optional[int] = None, + index_filter: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + brand_filter: Optional[List[str]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + entity_type: Optional[Union[str, "_models.GeographicEntityType"]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Free Form Search** + + **Applies to**\ : S0 and S1 pricing tiers. + + The basic default API is Free Form Search which handles the most fuzzy of inputs handling any + combination of address or POI tokens. This search API is the canonical 'single line search'. + The Free Form Search API is a seamless combination of POI search and geocoding. The API can + also be weighted with a contextual position (lat./lon. pair), or fully constrained by a + coordinate and radius, or it can be executed more generally without any geo biasing anchor + point.:code:`
`:code:`
`We strongly advise you to use the 'countrySet' parameter to + specify only the countries for which your application needs coverage, as the default behavior + will be to search the entire world, potentially returning unnecessary + results.:code:`
`:code:`
` E.g.: ``countrySet``\ =US,FR :code:`
`:code:`
`Please + see `Search Coverage + `_ for a complete + list of all the supported countries.:code:`
`:code:`
`Most Search queries default to + ``maxFuzzyLevel``\ =2 to gain performance and also reduce unusual results. This new default can + be overridden as needed per request by passing in the query param ``maxFuzzyLevel``\ =3 or 4. + + :param query: The applicable query string (e.g., "seattle", "pizza"). Can *also* be specified + as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, + -122.125679"). Must be properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param min_fuzzy_level: Minimum fuzziness level to be used. Default: 1, minimum: 1 and maximum: + 4 + + + * + Level 1 has no spell checking. + + * + Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to + "restaurant." + + * + Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell + checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" + to "mountain view" matching. + + * + Level 4 doesn’t add any more spell checking functions. + + The search engine will start looking for a match on the level defined by minFuzzyLevel, and + will stop searching at the level specified by maxFuzzyLevel. + :type min_fuzzy_level: int + :param max_fuzzy_level: Maximum fuzziness level to be used. Default: 2, minimum: 1 and maximum: + 4 + + + * + Level 1 has no spell checking. + + * + Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to + "restaurant." + + * + Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell + checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" + to "mountain view" matching. + + * + Level 4 doesn’t add any more spell checking functions. + + The search engine will start looking for a match on the level defined by minFuzzyLevel, and + will stop searching at the level specified by maxFuzzyLevel. + :type max_fuzzy_level: int + :param index_filter: A comma separated list of indexes which should be utilized for the search. + Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = + Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross + Streets (intersections). + :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.fuzzy_search.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if min_fuzzy_level is not None: + query_parameters['minFuzzyLevel'] = self._serialize.query("min_fuzzy_level", min_fuzzy_level, 'int', maximum=4, minimum=1) + if max_fuzzy_level is not None: + query_parameters['maxFuzzyLevel'] = self._serialize.query("max_fuzzy_level", max_fuzzy_level, 'int', maximum=4, minimum=1) + if index_filter is not None: + query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + fuzzy_search.metadata = {'url': '/search/fuzzy/{format}'} # type: ignore + + async def search_point_of_interest( + self, + query: str, + format: Union[str, "_models.ResponseFormat"] = "json", + is_type_ahead: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + category_filter: Optional[List[int]] = None, + country_filter: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius_in_meters: Optional[int] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.PointOfInterestExtendedPostalCodes"]]] = None, + brand_filter: Optional[List[str]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Get POI by Name** + + **Applies to**\ : S0 and S1 pricing tiers. + + Points of Interest (POI) Search allows you to request POI results by name. Search supports + additional query parameters such as language and filtering results by area of interest driven + by country or bounding box. Endpoint will return only POI results matching the query string. + Response includes POI details such as address, coordinate location and category. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks"), must be + properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **POI** = Points of Interest + + Value should be **POI** or **None** to disable extended postal codes. + + By default extended postal codes are included. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.PointOfInterestExtendedPostalCodes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_point_of_interest.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_point_of_interest.metadata = {'url': '/search/poi/{format}'} # type: ignore + + async def search_nearby_point_of_interest( + self, + lat: float, + lon: float, + format: Union[str, "_models.ResponseFormat"] = "json", + top: Optional[int] = None, + skip: Optional[int] = None, + category_filter: Optional[List[int]] = None, + country_filter: Optional[List[str]] = None, + radius_in_meters: Optional[int] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + brand_filter: Optional[List[str]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Nearby Search** + + **Applies to**\ : S0 and S1 pricing tiers. + + If you have a use case for only retrieving POI results around a specific location, the nearby + search method may be the right choice. This endpoint will only return POI results, and does not + take in a search query parameter. + + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area, Min value is 1, Max Value is 50000. + :type radius_in_meters: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_nearby_point_of_interest.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['lat'] = self._serialize.query("lat", lat, 'float') + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_nearby_point_of_interest.metadata = {'url': '/search/nearby/{format}'} # type: ignore + + async def search_point_of_interest_category( + self, + query: str, + format: Union[str, "_models.ResponseFormat"] = "json", + is_type_ahead: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + category_filter: Optional[List[int]] = None, + country_filter: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius_in_meters: Optional[int] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + brand_filter: Optional[List[str]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Get POI by Category** + + **Applies to**\ : S0 and S1 pricing tiers. + + Points of Interest (POI) Category Search allows you to request POI results from given category. + Search allows to query POIs from one category at a time. Endpoint will only return POI results + which are categorized as specified. Response includes POI details such as address, coordinate + location and classification. + + :param query: The POI category to search for (e.g., "AIRPORT", "RESTAURANT"), must be properly + URL encoded. Supported main categories can be requested by calling `Get Search POI Category + Tree API `_. List of available categories can also be + found `here `_. We + recommend to use POI Search Category Tree API to request the supported categories. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_point_of_interest_category.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_point_of_interest_category.metadata = {'url': '/search/poi/category/{format}'} # type: ignore + + async def get_point_of_interest_category_tree( + self, + format: Union[str, "_models.JsonFormat"] = "json", + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.PointOfInterestCategoryTreeResult": + """**Get POI Category Tree** + + **Applies to**\ : S0 and S1 pricing tiers. + + POI Category API provides a full list of supported Points of Interest (POI) categories and + subcategories together with their translations and synonyms. The returned content can be used + to provide more meaningful results through other Search Service APIs, like `Get Search POI + `_. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, except NGT and NGT-Latn. Language tag is case insensitive. When + data in specified language is not available for a specific field, default language is used + (English). + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointOfInterestCategoryTreeResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.PointOfInterestCategoryTreeResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointOfInterestCategoryTreeResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_point_of_interest_category_tree.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointOfInterestCategoryTreeResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_point_of_interest_category_tree.metadata = {'url': '/search/poi/category/tree/{format}'} # type: ignore + + async def search_address( + self, + query: str, + format: Union[str, "_models.ResponseFormat"] = "json", + is_type_ahead: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + country_filter: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius_in_meters: Optional[int] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + entity_type: Optional[Union[str, "_models.GeographicEntityType"]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Address Geocoding** + + **Applies to**\ : S0 and S1 pricing tiers. + + In many cases, the complete search service might be too much, for instance if you are only + interested in traditional geocoding. Search can also be accessed for address look up + exclusively. The geocoding is performed by hitting the geocode endpoint with just the address + or partial address in question. The geocoding search index will be queried for everything above + the street level data. No POIs will be returned. Note that the geocoder is very tolerant of + typos and incomplete addresses. It will also handle everything from exact street addresses or + street or intersections as well as higher level geographies such as city centers, counties, + states etc. + + :param query: The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be + properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_address.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_address.metadata = {'url': '/search/address/{format}'} # type: ignore + + async def reverse_search_address( + self, + query: List[float], + format: Union[str, "_models.ResponseFormat"] = "json", + language: Optional[str] = None, + include_speed_limit: Optional[bool] = None, + heading: Optional[int] = None, + radius_in_meters: Optional[int] = None, + number: Optional[str] = None, + include_road_use: Optional[bool] = None, + road_use: Optional[List[Union[str, "_models.RoadUseType"]]] = None, + allow_freeform_newline: Optional[bool] = None, + include_match_type: Optional[bool] = None, + entity_type: Optional[Union[str, "_models.GeographicEntityType"]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.ReverseSearchAddressResult": + """**Reverse Geocode to an Address** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) + into a human understandable street address. Most often this is needed in tracking applications + where you receive a GPS feed from the device or asset and wish to know what address where the + coordinate is located. This endpoint will return address information for a given coordinate. + + :param query: The applicable query specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param include_speed_limit: Boolean. To enable return of the posted speed limit. + :type include_speed_limit: bool + :param heading: The directional heading of the vehicle in degrees, for travel along a segment + of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can + include upto one decimal place. + :type heading: int + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param number: If a number is sent in along with the request, the response may include the side + of the street (Left/Right) and also an offset position for that number. + :type number: str + :param include_road_use: Boolean. To enable return of the road use array for reverse geocodes + at street level. + :type include_road_use: bool + :param road_use: To restrict reverse geocodes to a certain type of road use. The road use array + for reverse geocodes can be one or more of LimitedAccess, Arterial, Terminal, Ramp, Rotary, + LocalStreet. + :type road_use: list[str or ~azure.maps.search.models.RoadUseType] + :param allow_freeform_newline: Format of newlines in the formatted address. + + If true, the address will contain newlines. + If false, newlines will be converted to commas. + :type allow_freeform_newline: bool + :param include_match_type: Include information on the type of match the geocoder achieved in + the response. + :type include_match_type: bool + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.reverse_search_address.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, '[float]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if include_speed_limit is not None: + query_parameters['returnSpeedLimit'] = self._serialize.query("include_speed_limit", include_speed_limit, 'bool') + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if number is not None: + query_parameters['number'] = self._serialize.query("number", number, 'str') + if include_road_use is not None: + query_parameters['returnRoadUse'] = self._serialize.query("include_road_use", include_road_use, 'bool') + if road_use is not None: + query_parameters['roadUse'] = self._serialize.query("road_use", road_use, '[str]', div=',') + if allow_freeform_newline is not None: + query_parameters['allowFreeformNewline'] = self._serialize.query("allow_freeform_newline", allow_freeform_newline, 'bool') + if include_match_type is not None: + query_parameters['returnMatchType'] = self._serialize.query("include_match_type", include_match_type, 'bool') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ReverseSearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_address.metadata = {'url': '/search/address/reverse/{format}'} # type: ignore + + async def reverse_search_cross_street_address( + self, + query: List[float], + format: Union[str, "_models.ResponseFormat"] = "json", + top: Optional[int] = None, + heading: Optional[int] = None, + radius_in_meters: Optional[int] = None, + language: Optional[str] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.ReverseSearchCrossStreetAddressResult": + """**Reverse Geocode to a Cross Street** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) + into a human understandable cross street. Most often this is needed in tracking applications + where you receive a GPS feed from the device or asset and wish to know what address where the + coordinate is located. + This endpoint will return cross street information for a given coordinate. + + :param query: The applicable query specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param heading: The directional heading of the vehicle in degrees, for travel along a segment + of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can + include upto one decimal place. + :type heading: int + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchCrossStreetAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchCrossStreetAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchCrossStreetAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.reverse_search_cross_street_address.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, '[float]', div=',') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ReverseSearchCrossStreetAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_cross_street_address.metadata = {'url': '/search/address/reverse/crossStreet/{format}'} # type: ignore + + async def search_structured_address( + self, + format: Union[str, "_models.ResponseFormat"] = "json", + language: Optional[str] = None, + country_code: Optional[str] = "US", + top: Optional[int] = None, + skip: Optional[int] = None, + street_number: Optional[str] = None, + street_name: Optional[str] = None, + cross_street: Optional[str] = None, + municipality: Optional[str] = None, + municipality_subdivision: Optional[str] = None, + country_tertiary_subdivision: Optional[str] = None, + country_secondary_subdivision: Optional[str] = None, + country_subdivision: Optional[str] = None, + postal_code: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + entity_type: Optional[Union[str, "_models.GeographicEntityType"]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Structured Address Geocoding** + + **Applies to**\ : S0 and S1 pricing tiers. + + Azure Address Geocoding can also be accessed for structured address look up exclusively. The + geocoding search index will be queried for everything above the street level data. No POIs + will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. + It will also handle everything from exact street addresses or street or intersections as well + as higher level geographies such as city centers, counties, states etc. + + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param country_code: The 2 or 3 letter `ISO3166-1 + `_ country code portion of an address. E.g. + US. + :type country_code: str + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param street_number: The street number portion of an address. + :type street_number: str + :param street_name: The street name portion of an address. + :type street_name: str + :param cross_street: The cross street name for the structured address. + :type cross_street: str + :param municipality: The municipality portion of an address. + :type municipality: str + :param municipality_subdivision: The municipality subdivision (sub/super city) for the + structured address. + :type municipality_subdivision: str + :param country_tertiary_subdivision: The named area for the structured address. + :type country_tertiary_subdivision: str + :param country_secondary_subdivision: The county for the structured address. + :type country_secondary_subdivision: str + :param country_subdivision: The country subdivision portion of an address. + :type country_subdivision: str + :param postal_code: The postal code portion of an address. + :type postal_code: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_structured_address.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if country_code is not None: + query_parameters['countryCode'] = self._serialize.query("country_code", country_code, 'str') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if street_number is not None: + query_parameters['streetNumber'] = self._serialize.query("street_number", street_number, 'str') + if street_name is not None: + query_parameters['streetName'] = self._serialize.query("street_name", street_name, 'str') + if cross_street is not None: + query_parameters['crossStreet'] = self._serialize.query("cross_street", cross_street, 'str') + if municipality is not None: + query_parameters['municipality'] = self._serialize.query("municipality", municipality, 'str') + if municipality_subdivision is not None: + query_parameters['municipalitySubdivision'] = self._serialize.query("municipality_subdivision", municipality_subdivision, 'str') + if country_tertiary_subdivision is not None: + query_parameters['countryTertiarySubdivision'] = self._serialize.query("country_tertiary_subdivision", country_tertiary_subdivision, 'str') + if country_secondary_subdivision is not None: + query_parameters['countrySecondarySubdivision'] = self._serialize.query("country_secondary_subdivision", country_secondary_subdivision, 'str') + if country_subdivision is not None: + query_parameters['countrySubdivision'] = self._serialize.query("country_subdivision", country_subdivision, 'str') + if postal_code is not None: + query_parameters['postalCode'] = self._serialize.query("postal_code", postal_code, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_structured_address.metadata = {'url': '/search/address/structured/{format}'} # type: ignore + + async def search_inside_geometry( + self, + query: str, + geometry: "_models.SearchInsideGeometryRequest", + format: Union[str, "_models.ResponseFormat"] = "json", + top: Optional[int] = None, + language: Optional[str] = None, + category_filter: Optional[List[int]] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + index_filter: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Applies to**\ : S0 and S1 pricing tiers. + + The Search Geometry endpoint allows you to perform a free form search inside a single geometry + or many of them. The search results that fall inside the geometry/geometries will be + returned.:code:`
`:code:`
`To send the geometry you will use a ``POST`` request where the + request body will contain the ``geometry`` object represented as a ``GeoJSON`` type and the + ``Content-Type`` header will be set to ``application/json``. The geographical features to be + searched can be modeled as Polygon and/or Circle geometries represented using any one of the + following ``GeoJSON`` types::code:`
  • **GeoJSON FeatureCollection**
    The `geometry` can + be represented as a `GeoJSON FeatureCollection` object. This is the recommended option if the + geometry contains both Polygons and Circles. The `FeatureCollection` can contain a max of 50 + `GeoJSON Feature` objects. Each `Feature` object should represent either a Polygon or a Circle + with the following conditions:
    • A `Feature` object for the + Polygon geometry can have a max of 50 coordinates and it's properties must be empty.
    • A + `Feature` object for the Circle geometry is composed of a _center_ represented using a `GeoJSON + Point` type and a _radius_ value (in meters) which must be specified in the object's properties + along with the _subType_ property whose value should be 'Circle'.
    `:code:`
    ` Please + see the Examples section below for a sample ``FeatureCollection`` + representation.:code:`
    `:code:`
    `
  • :code:`
  • **GeoJSON GeometryCollection**
    The + `geometry` can be represented as a `GeoJSON GeometryCollection` object. This is the recommended + option if the geometry contains a list of Polygons only. The `GeometryCollection` can contain a + max of 50 `GeoJSON Polygon` objects. Each `Polygon` object can have a max of 50 coordinates. + Please see the Examples section below for a sample `GeometryCollection` + representation.

  • `:code:`
  • **GeoJSON Polygon**
    The `geometry` can be + represented as a `GeoJSON Polygon` object. This is the recommended option if the geometry + contains a single Polygon. The `Polygon` object can have a max of 50 coordinates. Please see + the Examples section below for a sample `Polygon` + representation.

  • `
.:code:`
`:code:`
`. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param geometry: This represents the geometry for one or more geographical features (parks, + state boundary etc.) to search in and should be a GeoJSON compliant type. Please refer to `RFC + 7946 `_ for details. + :type geometry: ~azure.maps.search.models.SearchInsideGeometryRequest + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param index_filter: A comma separated list of indexes which should be utilized for the search. + Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = + Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross + Streets (intersections). + :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.search_inside_geometry.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if index_filter is not None: + query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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(geometry, 'SearchInsideGeometryRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_inside_geometry.metadata = {'url': '/search/geometry/{format}'} # type: ignore + + async def search_along_route( + self, + query: str, + max_detour_time: int, + route: "_models.SearchAlongRouteRequest", + format: Union[str, "_models.ResponseFormat"] = "json", + top: Optional[int] = None, + brand_filter: Optional[List[str]] = None, + category_filter: Optional[List[int]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Applies to**\ : S0 and S1 pricing tiers. + + The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified + route. This search is constrained by specifying the ``maxDetourTime`` limiting + measure.:code:`
`:code:`
`To send the route-points you will use a ``POST`` request where + the request body will contain the ``route`` object represented as a ``GeoJSON LineString`` type + and the ``Content-Type`` header will be set to ``application/json``. Each route-point in + ``route`` is represented as a ``GeoJSON Position`` type i.e. an array where the *longitude* + value is followed by the *latitude* value and the *altitude* value is ignored. The ``route`` + should contain at least 2 route-points.:code:`
`:code:`
`It is possible that original + route will be altered, some of it's points may be skipped. If the route that passes through the + found point is faster than the original one, the ``detourTime`` value in the response is + negative. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param max_detour_time: Maximum detour time of the point of interest in seconds. Max value is + 3600 seconds. + :type max_detour_time: int + :param route: This represents the route to search along and should be a valid ``GeoJSON + LineString`` type. Please refer to `RFC 7946 + `_ for details. + :type route: ~azure.maps.search.models.SearchAlongRouteRequest + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default value is 10. Max value + is 20. + :type top: int + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.search_along_route.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + query_parameters['maxDetourTime'] = self._serialize.query("max_detour_time", max_detour_time, 'int', maximum=3600) + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=20) + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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(route, 'SearchAlongRouteRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_along_route.metadata = {'url': '/search/alongRoute/{format}'} # type: ignore + + async def fuzzy_search_batch_sync( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.SearchAddressBatchResult": + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of search fuzzy queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.fuzzy_search_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + fuzzy_search_batch_sync.metadata = {'url': '/search/fuzzy/batch/sync/{format}'} # type: ignore + + async def _fuzzy_search_batch_initial( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._fuzzy_search_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def begin_fuzzy_search_batch( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResult"]: + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of search fuzzy queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._fuzzy_search_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def _get_fuzzy_search_batch_initial( + self, + batch_id: str, + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self._get_fuzzy_search_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def begin_get_fuzzy_search_batch( + self, + batch_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResult"]: + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._get_fuzzy_search_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_get_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def search_address_batch_sync( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.SearchAddressBatchResult": + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of address geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_address_batch_sync.metadata = {'url': '/search/address/batch/sync/{format}'} # type: ignore + + async def _search_address_batch_initial( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def begin_search_address_batch( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResult"]: + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of address geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._search_address_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def _get_search_address_batch_initial( + self, + batch_id: str, + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self._get_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def begin_get_search_address_batch( + self, + batch_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResult"]: + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._get_search_address_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_get_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def reverse_search_address_batch_sync( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.ReverseSearchAddressBatchProcessResult": + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of reverse geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchAddressBatchProcessResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchAddressBatchProcessResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.reverse_search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_address_batch_sync.metadata = {'url': '/search/address/reverse/batch/sync/{format}'} # type: ignore + + async def _reverse_search_address_batch_initial( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> Optional["_models.ReverseSearchAddressBatchProcessResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReverseSearchAddressBatchProcessResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._reverse_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def begin_reverse_search_address_batch( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> AsyncLROPoller["_models.ReverseSearchAddressBatchProcessResult"]: + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of reverse geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReverseSearchAddressBatchProcessResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reverse_search_address_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def _get_reverse_search_address_batch_initial( + self, + batch_id: str, + **kwargs: Any + ) -> Optional["_models.ReverseSearchAddressBatchProcessResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReverseSearchAddressBatchProcessResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self._get_reverse_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def begin_get_reverse_search_address_batch( + self, + batch_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.ReverseSearchAddressBatchProcessResult"]: + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ReverseSearchAddressBatchProcessResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._get_reverse_search_address_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_get_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py new file mode 100644 index 000000000000..8ea3ff907483 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py @@ -0,0 +1,233 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Address + from ._models_py3 import AddressRanges + from ._models_py3 import BatchRequest + from ._models_py3 import BatchRequestItem + from ._models_py3 import BatchResult + from ._models_py3 import BatchResultItem + from ._models_py3 import BatchResultSummary + from ._models_py3 import BoundingBox + from ._models_py3 import BrandName + from ._models_py3 import Classification + from ._models_py3 import ClassificationName + from ._models_py3 import DataSource + from ._models_py3 import EntryPoint + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import GeoJsonFeature + from ._models_py3 import GeoJsonFeatureCollection + from ._models_py3 import GeoJsonFeatureCollectionData + from ._models_py3 import GeoJsonFeatureData + from ._models_py3 import GeoJsonGeometry + from ._models_py3 import GeoJsonGeometryCollection + from ._models_py3 import GeoJsonGeometryCollectionData + from ._models_py3 import GeoJsonLineString + from ._models_py3 import GeoJsonLineStringData + from ._models_py3 import GeoJsonMultiLineString + from ._models_py3 import GeoJsonMultiLineStringData + from ._models_py3 import GeoJsonMultiPoint + from ._models_py3 import GeoJsonMultiPointData + from ._models_py3 import GeoJsonMultiPolygon + from ._models_py3 import GeoJsonMultiPolygonData + from ._models_py3 import GeoJsonObject + from ._models_py3 import GeoJsonPoint + from ._models_py3 import GeoJsonPointData + from ._models_py3 import GeoJsonPolygon + from ._models_py3 import GeoJsonPolygonData + from ._models_py3 import GeometryIdentifier + from ._models_py3 import LatLongPairAbbreviated + from ._models_py3 import OperatingHours + from ._models_py3 import OperatingHoursTime + from ._models_py3 import OperatingHoursTimeRange + from ._models_py3 import PointOfInterest + from ._models_py3 import PointOfInterestCategory + from ._models_py3 import PointOfInterestCategorySet + from ._models_py3 import PointOfInterestCategoryTreeResult + from ._models_py3 import Polygon + from ._models_py3 import PolygonResult + from ._models_py3 import ReverseSearchAddressBatchItem + from ._models_py3 import ReverseSearchAddressBatchItemResponse + from ._models_py3 import ReverseSearchAddressBatchProcessResult + from ._models_py3 import ReverseSearchAddressResult + from ._models_py3 import ReverseSearchAddressResultItem + from ._models_py3 import ReverseSearchCrossStreetAddressResult + from ._models_py3 import ReverseSearchCrossStreetAddressResultItem + from ._models_py3 import SearchAddressBatchItem + from ._models_py3 import SearchAddressBatchItemResponse + from ._models_py3 import SearchAddressBatchResult + from ._models_py3 import SearchAddressResult + from ._models_py3 import SearchAddressResultItem + from ._models_py3 import SearchAlongRouteRequest + from ._models_py3 import SearchInsideGeometryRequest + from ._models_py3 import SearchSummary + from ._models_py3 import Viewport +except (SyntaxError, ImportError): + from ._models import Address # type: ignore + from ._models import AddressRanges # type: ignore + from ._models import BatchRequest # type: ignore + from ._models import BatchRequestItem # type: ignore + from ._models import BatchResult # type: ignore + from ._models import BatchResultItem # type: ignore + from ._models import BatchResultSummary # type: ignore + from ._models import BoundingBox # type: ignore + from ._models import BrandName # type: ignore + from ._models import Classification # type: ignore + from ._models import ClassificationName # type: ignore + from ._models import DataSource # type: ignore + from ._models import EntryPoint # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import GeoJsonFeature # type: ignore + from ._models import GeoJsonFeatureCollection # type: ignore + from ._models import GeoJsonFeatureCollectionData # type: ignore + from ._models import GeoJsonFeatureData # type: ignore + from ._models import GeoJsonGeometry # type: ignore + from ._models import GeoJsonGeometryCollection # type: ignore + from ._models import GeoJsonGeometryCollectionData # type: ignore + from ._models import GeoJsonLineString # type: ignore + from ._models import GeoJsonLineStringData # type: ignore + from ._models import GeoJsonMultiLineString # type: ignore + from ._models import GeoJsonMultiLineStringData # type: ignore + from ._models import GeoJsonMultiPoint # type: ignore + from ._models import GeoJsonMultiPointData # type: ignore + from ._models import GeoJsonMultiPolygon # type: ignore + from ._models import GeoJsonMultiPolygonData # type: ignore + from ._models import GeoJsonObject # type: ignore + from ._models import GeoJsonPoint # type: ignore + from ._models import GeoJsonPointData # type: ignore + from ._models import GeoJsonPolygon # type: ignore + from ._models import GeoJsonPolygonData # type: ignore + from ._models import GeometryIdentifier # type: ignore + from ._models import LatLongPairAbbreviated # type: ignore + from ._models import OperatingHours # type: ignore + from ._models import OperatingHoursTime # type: ignore + from ._models import OperatingHoursTimeRange # type: ignore + from ._models import PointOfInterest # type: ignore + from ._models import PointOfInterestCategory # type: ignore + from ._models import PointOfInterestCategorySet # type: ignore + from ._models import PointOfInterestCategoryTreeResult # type: ignore + from ._models import Polygon # type: ignore + from ._models import PolygonResult # type: ignore + from ._models import ReverseSearchAddressBatchItem # type: ignore + from ._models import ReverseSearchAddressBatchItemResponse # type: ignore + from ._models import ReverseSearchAddressBatchProcessResult # type: ignore + from ._models import ReverseSearchAddressResult # type: ignore + from ._models import ReverseSearchAddressResultItem # type: ignore + from ._models import ReverseSearchCrossStreetAddressResult # type: ignore + from ._models import ReverseSearchCrossStreetAddressResultItem # type: ignore + from ._models import SearchAddressBatchItem # type: ignore + from ._models import SearchAddressBatchItemResponse # type: ignore + from ._models import SearchAddressBatchResult # type: ignore + from ._models import SearchAddressResult # type: ignore + from ._models import SearchAddressResultItem # type: ignore + from ._models import SearchAlongRouteRequest # type: ignore + from ._models import SearchInsideGeometryRequest # type: ignore + from ._models import SearchSummary # type: ignore + from ._models import Viewport # type: ignore + +from ._search_client_enums import ( + ElectricVehicleConnector, + EntryPointType, + GeoJsonObjectType, + GeographicEntityType, + JsonFormat, + LocalizedMapView, + MatchType, + OperatingHoursRange, + PointOfInterestExtendedPostalCodes, + QueryType, + ResponseFormat, + RoadUseType, + SearchAddressResultType, + SearchIndexes, +) + +__all__ = [ + 'Address', + 'AddressRanges', + 'BatchRequest', + 'BatchRequestItem', + 'BatchResult', + 'BatchResultItem', + 'BatchResultSummary', + 'BoundingBox', + 'BrandName', + 'Classification', + 'ClassificationName', + 'DataSource', + 'EntryPoint', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'GeoJsonFeature', + 'GeoJsonFeatureCollection', + 'GeoJsonFeatureCollectionData', + 'GeoJsonFeatureData', + 'GeoJsonGeometry', + 'GeoJsonGeometryCollection', + 'GeoJsonGeometryCollectionData', + 'GeoJsonLineString', + 'GeoJsonLineStringData', + 'GeoJsonMultiLineString', + 'GeoJsonMultiLineStringData', + 'GeoJsonMultiPoint', + 'GeoJsonMultiPointData', + 'GeoJsonMultiPolygon', + 'GeoJsonMultiPolygonData', + 'GeoJsonObject', + 'GeoJsonPoint', + 'GeoJsonPointData', + 'GeoJsonPolygon', + 'GeoJsonPolygonData', + 'GeometryIdentifier', + 'LatLongPairAbbreviated', + 'OperatingHours', + 'OperatingHoursTime', + 'OperatingHoursTimeRange', + 'PointOfInterest', + 'PointOfInterestCategory', + 'PointOfInterestCategorySet', + 'PointOfInterestCategoryTreeResult', + 'Polygon', + 'PolygonResult', + 'ReverseSearchAddressBatchItem', + 'ReverseSearchAddressBatchItemResponse', + 'ReverseSearchAddressBatchProcessResult', + 'ReverseSearchAddressResult', + 'ReverseSearchAddressResultItem', + 'ReverseSearchCrossStreetAddressResult', + 'ReverseSearchCrossStreetAddressResultItem', + 'SearchAddressBatchItem', + 'SearchAddressBatchItemResponse', + 'SearchAddressBatchResult', + 'SearchAddressResult', + 'SearchAddressResultItem', + 'SearchAlongRouteRequest', + 'SearchInsideGeometryRequest', + 'SearchSummary', + 'Viewport', + 'ElectricVehicleConnector', + 'EntryPointType', + 'GeoJsonObjectType', + 'GeographicEntityType', + 'JsonFormat', + 'LocalizedMapView', + 'MatchType', + 'OperatingHoursRange', + 'PointOfInterestExtendedPostalCodes', + 'QueryType', + 'ResponseFormat', + 'RoadUseType', + 'SearchAddressResultType', + 'SearchIndexes', +] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py b/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py new file mode 100644 index 000000000000..0685797302fa --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py @@ -0,0 +1,2154 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Address(msrest.serialization.Model): + """The address of the result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar building_number: The building number on the street. DEPRECATED, use streetNumber instead. + :vartype building_number: str + :ivar street: The street name. DEPRECATED, use streetName instead. + :vartype street: str + :ivar cross_street: The name of the street being crossed. + :vartype cross_street: str + :ivar street_number: The building number on the street. + :vartype street_number: str + :ivar route_numbers: The codes used to unambiguously identify the street. + :vartype route_numbers: list[int] + :ivar street_name: The street name. + :vartype street_name: str + :ivar street_name_and_number: The street name and number. + :vartype street_name_and_number: str + :ivar municipality: City / Town. + :vartype municipality: str + :ivar municipality_subdivision: Sub / Super City. + :vartype municipality_subdivision: str + :ivar country_tertiary_subdivision: Named Area. + :vartype country_tertiary_subdivision: str + :ivar country_secondary_subdivision: County. + :vartype country_secondary_subdivision: str + :ivar country_subdivision: State or Province. + :vartype country_subdivision: str + :ivar postal_code: Postal Code / Zip Code. + :vartype postal_code: str + :ivar extended_postal_code: Extended postal code (availability is dependent on the region). + :vartype extended_postal_code: str + :ivar country_code: Country (Note: This is a two-letter code, not a country name.). + :vartype country_code: str + :ivar country: Country name. + :vartype country: str + :ivar country_code_iso3: ISO alpha-3 country code. + :vartype country_code_iso3: str + :ivar freeform_address: An address line formatted according to the formatting rules of a + Result's country of origin, or in the case of a country, its full country name. + :vartype freeform_address: str + :ivar country_subdivision_name: The full name of a first level of country administrative + hierarchy. This field appears only in case countrySubdivision is presented in an abbreviated + form. Only supported for USA, Canada, and Great Britain. + :vartype country_subdivision_name: str + :ivar local_name: An address component which represents the name of a geographic area or + locality that groups a number of addressable objects for addressing purposes, without being an + administrative unit. This field is used to build the ``freeformAddress`` property. + :vartype local_name: str + :ivar bounding_box: Bounding box coordinates. + :vartype bounding_box: any + """ + + _validation = { + 'building_number': {'readonly': True}, + 'street': {'readonly': True}, + 'cross_street': {'readonly': True}, + 'street_number': {'readonly': True}, + 'route_numbers': {'readonly': True}, + 'street_name': {'readonly': True}, + 'street_name_and_number': {'readonly': True}, + 'municipality': {'readonly': True}, + 'municipality_subdivision': {'readonly': True}, + 'country_tertiary_subdivision': {'readonly': True}, + 'country_secondary_subdivision': {'readonly': True}, + 'country_subdivision': {'readonly': True}, + 'postal_code': {'readonly': True}, + 'extended_postal_code': {'readonly': True}, + 'country_code': {'readonly': True}, + 'country': {'readonly': True}, + 'country_code_iso3': {'readonly': True}, + 'freeform_address': {'readonly': True}, + 'country_subdivision_name': {'readonly': True}, + 'local_name': {'readonly': True}, + 'bounding_box': {'readonly': True}, + } + + _attribute_map = { + 'building_number': {'key': 'buildingNumber', 'type': 'str'}, + 'street': {'key': 'street', 'type': 'str'}, + 'cross_street': {'key': 'crossStreet', 'type': 'str'}, + 'street_number': {'key': 'streetNumber', 'type': 'str'}, + 'route_numbers': {'key': 'routeNumbers', 'type': '[int]'}, + 'street_name': {'key': 'streetName', 'type': 'str'}, + 'street_name_and_number': {'key': 'streetNameAndNumber', 'type': 'str'}, + 'municipality': {'key': 'municipality', 'type': 'str'}, + 'municipality_subdivision': {'key': 'municipalitySubdivision', 'type': 'str'}, + 'country_tertiary_subdivision': {'key': 'countryTertiarySubdivision', 'type': 'str'}, + 'country_secondary_subdivision': {'key': 'countrySecondarySubdivision', 'type': 'str'}, + 'country_subdivision': {'key': 'countrySubdivision', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'extended_postal_code': {'key': 'extendedPostalCode', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'country_code_iso3': {'key': 'countryCodeISO3', 'type': 'str'}, + 'freeform_address': {'key': 'freeformAddress', 'type': 'str'}, + 'country_subdivision_name': {'key': 'countrySubdivisionName', 'type': 'str'}, + 'local_name': {'key': 'localName', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(Address, self).__init__(**kwargs) + self.building_number = None + self.street = None + self.cross_street = None + self.street_number = None + self.route_numbers = None + self.street_name = None + self.street_name_and_number = None + self.municipality = None + self.municipality_subdivision = None + self.country_tertiary_subdivision = None + self.country_secondary_subdivision = None + self.country_subdivision = None + self.postal_code = None + self.extended_postal_code = None + self.country_code = None + self.country = None + self.country_code_iso3 = None + self.freeform_address = None + self.country_subdivision_name = None + self.local_name = None + self.bounding_box = None + + +class AddressRanges(msrest.serialization.Model): + """Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included. + + :param range_left: Address range on the left side of the street. + :type range_left: str + :param range_right: Address range on the right side of the street. + :type range_right: str + :param from_property: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type from_property: ~azure.maps.search.models.LatLongPairAbbreviated + :param to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. + :type to: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'range_left': {'key': 'rangeLeft', 'type': 'str'}, + 'range_right': {'key': 'rangeRight', 'type': 'str'}, + 'from_property': {'key': 'from', 'type': 'LatLongPairAbbreviated'}, + 'to': {'key': 'to', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(AddressRanges, self).__init__(**kwargs) + self.range_left = kwargs.get('range_left', None) + self.range_right = kwargs.get('range_right', None) + self.from_property = kwargs.get('from_property', None) + self.to = kwargs.get('to', None) + + +class BatchRequest(msrest.serialization.Model): + """This type represents the request body for the Batch service. + + :param batch_items: The list of queries to process. + :type batch_items: list[~azure.maps.search.models.BatchRequestItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequest, self).__init__(**kwargs) + self.batch_items = kwargs.get('batch_items', None) + + +class BatchRequestItem(msrest.serialization.Model): + """Batch request object. + + :param query: This parameter contains a query string used to perform an unstructured geocoding + operation. The query string will be passed verbatim to the search API for processing. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequestItem, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + + +class BatchResult(msrest.serialization.Model): + """This object is returned from a successful Batch service call. Extend with 'batchItems' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + """ + + _validation = { + 'batch_summary': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResult, self).__init__(**kwargs) + self.batch_summary = None + + +class BatchResultItem(msrest.serialization.Model): + """An item returned from Batch API. Extend with 'response' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchResultSummary(msrest.serialization.Model): + """Summary of the results for the batch request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_requests: Number of successful requests in the batch. + :vartype successful_requests: int + :ivar total_requests: Total number of requests in the batch. + :vartype total_requests: int + """ + + _validation = { + 'successful_requests': {'readonly': True}, + 'total_requests': {'readonly': True}, + } + + _attribute_map = { + 'successful_requests': {'key': 'successfulRequests', 'type': 'int'}, + 'total_requests': {'key': 'totalRequests', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class BoundingBox(msrest.serialization.Model): + """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. + + :param top_left: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type top_left: ~azure.maps.search.models.LatLongPairAbbreviated + :param bottom_right: A location represented as a latitude and longitude using short names 'lat' + & 'lon'. + :type bottom_right: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'top_left': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, + 'bottom_right': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(BoundingBox, self).__init__(**kwargs) + self.top_left = kwargs.get('top_left', None) + self.bottom_right = kwargs.get('bottom_right', None) + + +class BrandName(msrest.serialization.Model): + """The name of the brand for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the brand. + :vartype name: str + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BrandName, self).__init__(**kwargs) + self.name = None + + +class Classification(msrest.serialization.Model): + """The classification for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code property. + :vartype code: str + :ivar names: Names array. + :vartype names: list[~azure.maps.search.models.ClassificationName] + """ + + _validation = { + 'code': {'readonly': True}, + 'names': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'names': {'key': 'names', 'type': '[ClassificationName]'}, + } + + def __init__( + self, + **kwargs + ): + super(Classification, self).__init__(**kwargs) + self.code = None + self.names = None + + +class ClassificationName(msrest.serialization.Model): + """Name for the classification. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_locale: Name Locale property. + :vartype name_locale: str + :ivar name: Name property. + :vartype name: str + """ + + _validation = { + 'name_locale': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name_locale': {'key': 'nameLocale', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClassificationName, self).__init__(**kwargs) + self.name_locale = None + self.name = None + + +class DataSource(msrest.serialization.Model): + """Optional section. Reference ids for use with the `Get Search Polygon `_ API. + + :param geometry: Information about the geometric shape of the result. Only present if type == + Geography. + :type geometry: ~azure.maps.search.models.GeometryIdentifier + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeometryIdentifier'}, + } + + def __init__( + self, + **kwargs + ): + super(DataSource, self).__init__(**kwargs) + self.geometry = kwargs.get('geometry', None) + + +class EntryPoint(msrest.serialization.Model): + """The entry point for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of entry point. Value can be either *main* or *minor*. Possible values + include: "main", "minor". + :vartype type: str or ~azure.maps.search.models.EntryPointType + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(EntryPoint, self).__init__(**kwargs) + self.type = None + self.position = kwargs.get('position', None) + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.maps.search.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.search.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class GeoJsonFeatureData(msrest.serialization.Model): + """GeoJsonFeatureData. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.search.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + """ + + _validation = { + 'geometry': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureData, self).__init__(**kwargs) + self.geometry = kwargs['geometry'] + self.properties = kwargs.get('properties', None) + self.id = kwargs.get('id', None) + self.feature_type = kwargs.get('feature_type', None) + + +class GeoJsonObject(msrest.serialization.Model): + """A valid ``GeoJSON`` object. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', 'GeoJsonGeometry': 'GeoJsonGeometry'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonObject, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): + """A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.search.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'geometry': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeature, self).__init__(**kwargs) + self.geometry = kwargs['geometry'] + self.properties = kwargs.get('properties', None) + self.id = kwargs.get('id', None) + self.feature_type = kwargs.get('feature_type', None) + self.type = 'Feature' # type: str + self.type = 'Feature' # type: str + + +class GeoJsonFeatureCollectionData(msrest.serialization.Model): + """GeoJsonFeatureCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.search.models.GeoJsonFeature] + """ + + _validation = { + 'features': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.features = kwargs['features'] + + +class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.search.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(**kwargs) + self.features = kwargs['features'] + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # type: str + + +class GeoJsonGeometry(GeoJsonObject): + """A valid ``GeoJSON`` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'GeometryCollection': 'GeoJsonGeometryCollection', 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometry, self).__init__(**kwargs) + self.type = 'GeoJsonGeometry' # type: str + + +class GeoJsonGeometryCollectionData(msrest.serialization.Model): + """GeoJsonGeometryCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.search.models.GeoJsonGeometry] + """ + + _validation = { + 'geometries': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) + self.geometries = kwargs['geometries'] + + +class GeoJsonGeometryCollection(GeoJsonGeometry, GeoJsonGeometryCollectionData): + """A valid ``GeoJSON GeometryCollection`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.search.models.GeoJsonGeometry] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'geometries': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometryCollection, self).__init__(**kwargs) + self.geometries = kwargs['geometries'] + self.type = 'GeometryCollection' # type: str + self.type = 'GeometryCollection' # type: str + + +class GeoJsonLineStringData(msrest.serialization.Model): + """GeoJsonLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonLineStringData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonLineString(GeoJsonGeometry, GeoJsonLineStringData): + """A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonLineString, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'LineString' # type: str + self.type = 'LineString' # type: str + + +class GeoJsonMultiLineStringData(msrest.serialization.Model): + """GeoJsonMultiLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiLineStringData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiLineString(GeoJsonGeometry, GeoJsonMultiLineStringData): + """A valid ``GeoJSON MultiLineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiLineString, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiLineString' # type: str + self.type = 'MultiLineString' # type: str + + +class GeoJsonMultiPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson MultiPoint``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPointData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiPoint(GeoJsonGeometry, GeoJsonMultiPointData): + """A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPoint, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiPoint' # type: str + self.type = 'MultiPoint' # type: str + + +class GeoJsonMultiPolygonData(msrest.serialization.Model): + """GeoJsonMultiPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPolygonData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiPolygon(GeoJsonGeometry, GeoJsonMultiPolygonData): + """A valid ``GeoJSON MultiPolygon`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPolygon, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiPolygon' # type: str + self.type = 'MultiPolygon' # type: str + + +class GeoJsonPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson Point``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPointData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonPoint(GeoJsonGeometry, GeoJsonPointData): + """A valid ``GeoJSON Point`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPoint, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'Point' # type: str + self.type = 'Point' # type: str + + +class GeoJsonPolygonData(msrest.serialization.Model): + """GeoJsonPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPolygonData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonPolygon(GeoJsonGeometry, GeoJsonPolygonData): + """A valid ``GeoJSON Polygon`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPolygon, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'Polygon' # type: str + self.type = 'Polygon' # type: str + + +class GeometryIdentifier(msrest.serialization.Model): + """Information about the geometric shape of the result. Only present if type == Geography. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Pass this as geometryId to the `Get Search Polygon + `_ API to fetch geometry + information for this result. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeometryIdentifier, self).__init__(**kwargs) + self.id = None + + +class LatLongPairAbbreviated(msrest.serialization.Model): + """A location represented as a latitude and longitude using short names 'lat' & 'lon'. + + :param lat: Latitude property. + :type lat: float + :param lon: Longitude property. + :type lon: float + """ + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(LatLongPairAbbreviated, self).__init__(**kwargs) + self.lat = kwargs.get('lat', None) + self.lon = kwargs.get('lon', None) + + +class OperatingHours(msrest.serialization.Model): + """Opening hours for a POI (Points of Interest). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mode: Value used in the request: none or "nextSevenDays". + :vartype mode: str + :ivar time_ranges: List of time ranges for the next 7 days. + :vartype time_ranges: list[~azure.maps.search.models.OperatingHoursTimeRange] + """ + + _validation = { + 'mode': {'readonly': True}, + 'time_ranges': {'readonly': True}, + } + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'time_ranges': {'key': 'timeRanges', 'type': '[OperatingHoursTimeRange]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHours, self).__init__(**kwargs) + self.mode = None + self.time_ranges = None + + +class OperatingHoursTime(msrest.serialization.Model): + """Represents a date and time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar date: Represents current calendar date in POI time zone, e.g. "2019-02-07". + :vartype date: str + :ivar hour: Hours are in the 24 hour format in the local time of a POI; possible values are 0 - + 23. + :vartype hour: int + :ivar minute: Minutes are in the local time of a POI; possible values are 0 - 59. + :vartype minute: int + """ + + _validation = { + 'date': {'readonly': True}, + 'hour': {'readonly': True}, + 'minute': {'readonly': True}, + } + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + 'hour': {'key': 'hour', 'type': 'int'}, + 'minute': {'key': 'minute', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHoursTime, self).__init__(**kwargs) + self.date = None + self.hour = None + self.minute = None + + +class OperatingHoursTimeRange(msrest.serialization.Model): + """Open time range for a day. + + :param start_time: The point in the next 7 days range when a given POI is being opened, or the + beginning of the range if it was opened before the range. + :type start_time: ~azure.maps.search.models.OperatingHoursTime + :param end_time: The point in the next 7 days range when a given POI is being closed, or the + beginning of the range if it was closed before the range. + :type end_time: ~azure.maps.search.models.OperatingHoursTime + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'OperatingHoursTime'}, + 'end_time': {'key': 'endTime', 'type': 'OperatingHoursTime'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHoursTimeRange, self).__init__(**kwargs) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + + +class PointOfInterest(msrest.serialization.Model): + """Details of the returned POI including information such as the name, phone, url address, and classifications. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the POI property. + :vartype name: str + :ivar phone: Telephone number property. + :vartype phone: str + :ivar url: Website URL property. + :vartype url: str + :ivar category_set: The list of the most specific POI categories. + :vartype category_set: list[~azure.maps.search.models.PointOfInterestCategorySet] + :ivar classifications: Classification array. + :vartype classifications: list[~azure.maps.search.models.Classification] + :ivar brands: Brands array. The name of the brand for the POI being returned. + :vartype brands: list[~azure.maps.search.models.BrandName] + :param operating_hours: Opening hours for a POI (Points of Interest). + :type operating_hours: ~azure.maps.search.models.OperatingHours + """ + + _validation = { + 'name': {'readonly': True}, + 'phone': {'readonly': True}, + 'url': {'readonly': True}, + 'category_set': {'readonly': True}, + 'classifications': {'readonly': True}, + 'brands': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'category_set': {'key': 'categorySet', 'type': '[PointOfInterestCategorySet]'}, + 'classifications': {'key': 'classifications', 'type': '[Classification]'}, + 'brands': {'key': 'brands', 'type': '[BrandName]'}, + 'operating_hours': {'key': 'openingHours', 'type': 'OperatingHours'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterest, self).__init__(**kwargs) + self.name = None + self.phone = None + self.url = None + self.category_set = None + self.classifications = None + self.brands = None + self.operating_hours = kwargs.get('operating_hours', None) + + +class PointOfInterestCategory(msrest.serialization.Model): + """POI category result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Unique ID for the category. ID can be used to restrict search results to specific + categories through other Search Service APIs, like `Get Search POI + `_. + :vartype id: int + :ivar name: Name of the category. + :vartype name: str + :ivar child_ids: Array of child category ids. + :vartype child_ids: list[int] + :ivar synonyms: Array of alternative names of the category. + :vartype synonyms: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'child_ids': {'readonly': True}, + 'synonyms': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'child_ids': {'key': 'childCategoryIds', 'type': '[int]'}, + 'synonyms': {'key': 'synonyms', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategory, self).__init__(**kwargs) + self.id = None + self.name = None + self.child_ids = None + self.synonyms = None + + +class PointOfInterestCategorySet(msrest.serialization.Model): + """POI category. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Category ID. + :vartype id: int + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategorySet, self).__init__(**kwargs) + self.id = None + + +class PointOfInterestCategoryTreeResult(msrest.serialization.Model): + """This object is returned from a successful POI Category Tree call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar categories: Categories array. + :vartype categories: list[~azure.maps.search.models.PointOfInterestCategory] + """ + + _validation = { + 'categories': {'readonly': True}, + } + + _attribute_map = { + 'categories': {'key': 'poiCategories', 'type': '[PointOfInterestCategory]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategoryTreeResult, self).__init__(**kwargs) + self.categories = None + + +class Polygon(msrest.serialization.Model): + """Polygon. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider_id: ID of the returned entity. + :vartype provider_id: str + :param geometry_data: Geometry data in GeoJSON format. Please refer to `RFC 7946 + `_ for details. Present only if "error" is not present. + :type geometry_data: ~azure.maps.search.models.GeoJsonObject + """ + + _validation = { + 'provider_id': {'readonly': True}, + } + + _attribute_map = { + 'provider_id': {'key': 'providerID', 'type': 'str'}, + 'geometry_data': {'key': 'geometryData', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + **kwargs + ): + super(Polygon, self).__init__(**kwargs) + self.provider_id = None + self.geometry_data = kwargs.get('geometry_data', None) + + +class PolygonResult(msrest.serialization.Model): + """This object is returned from a successful Search Polygon call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar polygons: Results array. + :vartype polygons: list[~azure.maps.search.models.Polygon] + """ + + _validation = { + 'polygons': {'readonly': True}, + } + + _attribute_map = { + 'polygons': {'key': 'additionalData', 'type': '[Polygon]'}, + } + + def __init__( + self, + **kwargs + ): + super(PolygonResult, self).__init__(**kwargs) + self.polygons = None + + +class ReverseSearchAddressBatchItem(BatchResultItem): + """An item returned from Search Address Reverse Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. SearchAddressReverseResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.ReverseSearchAddressBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'ReverseSearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class ReverseSearchAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search Address Reverse call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressResult, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class ReverseSearchAddressBatchItemResponse(ErrorResponse, ReverseSearchAddressResult): + """The result of the query. SearchAddressReverseResponse if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchItemResponse, self).__init__(**kwargs) + self.summary = None + self.addresses = None + self.error = kwargs.get('error', None) + + +class ReverseSearchAddressBatchProcessResult(BatchResult): + """This object is returned from a successful Search Address Reverse Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.ReverseSearchAddressBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[ReverseSearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchProcessResult, self).__init__(**kwargs) + self.batch_items = None + + +class ReverseSearchAddressResultItem(msrest.serialization.Model): + """Result object for a Search Address Reverse response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + :ivar road_use: + :vartype road_use: list[str or ~azure.maps.search.models.RoadUseType] + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". + :vartype match_type: str or ~azure.maps.search.models.MatchType + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + 'road_use': {'readonly': True}, + 'match_type': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'str'}, + 'road_use': {'key': 'roadUse', 'type': '[str]'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressResultItem, self).__init__(**kwargs) + self.address = None + self.position = None + self.road_use = None + self.match_type = None + + +class ReverseSearchCrossStreetAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search Address Reverse CrossStreet call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse Cross Street response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchCrossStreetAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchCrossStreetAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchCrossStreetAddressResult, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class ReverseSearchCrossStreetAddressResultItem(msrest.serialization.Model): + """Result object for a Search Address Reverse Cross Street response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchCrossStreetAddressResultItem, self).__init__(**kwargs) + self.address = None + self.position = None + + +class SearchAddressBatchItem(BatchResultItem): + """An item returned from Search Address Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. SearchAddressResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.SearchAddressBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'SearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search calls. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search API response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressResult, self).__init__(**kwargs) + self.summary = None + self.results = None + + +class SearchAddressBatchItemResponse(ErrorResponse, SearchAddressResult): + """The result of the query. SearchAddressResponse if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search API response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchItemResponse, self).__init__(**kwargs) + self.summary = None + self.results = None + self.error = kwargs.get('error', None) + + +class SearchAddressBatchResult(BatchResult): + """This object is returned from a successful Search Address Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchAddressBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchResult, self).__init__(**kwargs) + self.batch_items = None + + +class SearchAddressResultItem(msrest.serialization.Model): + """Result object for a Search API response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: One of: + + + * POI + * Street + * Geography + * Point Address + * Address Range + * Cross Street. Possible values include: "POI", "Street", "Geography", "Point Address", + "Address Range", "Cross Street". + :vartype type: str or ~azure.maps.search.models.SearchAddressResultType + :ivar id: Id property. + :vartype id: str + :ivar score: The value within a result set to indicate the relative matching score between + results. You can use this to determine that result x is twice as likely to be as relevant as + result y if the value of x is 2x the value of y. The values vary between queries and is only + meant as a relative value for one result set. + :vartype score: float + :ivar distance_in_meters: Straight line distance between the result and geobias location in + meters. + :vartype distance_in_meters: float + :ivar info: Information about the original data source of the Result. Used for support + requests. + :vartype info: str + :param entity_type: Possible values include: "Country", "CountrySubdivision", + "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", + "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :ivar point_of_interest: Details of the returned POI including information such as the name, + phone, url address, and classifications. + :vartype point_of_interest: ~azure.maps.search.models.PointOfInterest + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.LatLongPairAbbreviated + :ivar viewport: The viewport that covers the result represented by the top-left and + bottom-right coordinates of the viewport. + :vartype viewport: ~azure.maps.search.models.BoundingBox + :ivar entry_points: Array of EntryPoints. Those describe the types of entrances available at + the location. The type can be "main" for main entrances such as a front door, or a lobby, and + "minor", for side and back doors. + :vartype entry_points: list[~azure.maps.search.models.EntryPoint] + :ivar address_ranges: Describes the address range on both sides of the street for a search + result. Coordinates for the start and end locations of the address range are included. + :vartype address_ranges: ~azure.maps.search.models.AddressRanges + :ivar data_sources: Optional section. Reference geometry id for use with the `Get Search + Polygon `_ API. + :vartype data_sources: ~azure.maps.search.models.DataSource + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". + :vartype match_type: str or ~azure.maps.search.models.MatchType + :ivar detour_time: Detour time in seconds. Only returned for calls to the Search Along Route + API. + :vartype detour_time: int + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'score': {'readonly': True}, + 'distance_in_meters': {'readonly': True}, + 'info': {'readonly': True}, + 'point_of_interest': {'readonly': True}, + 'address': {'readonly': True}, + 'viewport': {'readonly': True}, + 'entry_points': {'readonly': True}, + 'address_ranges': {'readonly': True}, + 'data_sources': {'readonly': True}, + 'match_type': {'readonly': True}, + 'detour_time': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'distance_in_meters': {'key': 'dist', 'type': 'float'}, + 'info': {'key': 'info', 'type': 'str'}, + 'entity_type': {'key': 'entityType', 'type': 'str'}, + 'point_of_interest': {'key': 'poi', 'type': 'PointOfInterest'}, + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, + 'viewport': {'key': 'viewport', 'type': 'BoundingBox'}, + 'entry_points': {'key': 'entryPoints', 'type': '[EntryPoint]'}, + 'address_ranges': {'key': 'addressRanges', 'type': 'AddressRanges'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSource'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + 'detour_time': {'key': 'detourTime', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressResultItem, self).__init__(**kwargs) + self.type = None + self.id = None + self.score = None + self.distance_in_meters = None + self.info = None + self.entity_type = kwargs.get('entity_type', None) + self.point_of_interest = None + self.address = None + self.position = kwargs.get('position', None) + self.viewport = None + self.entry_points = None + self.address_ranges = None + self.data_sources = None + self.match_type = None + self.detour_time = None + + +class SearchAlongRouteRequest(msrest.serialization.Model): + """This type represents the request body for the Search Along Route service. + + :param route: A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 + `_ for details. + :type route: ~azure.maps.search.models.GeoJsonLineString + """ + + _attribute_map = { + 'route': {'key': 'route', 'type': 'GeoJsonLineString'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAlongRouteRequest, self).__init__(**kwargs) + self.route = kwargs.get('route', None) + + +class SearchInsideGeometryRequest(msrest.serialization.Model): + """This type represents the request body for the Search Inside Geometry service. + + :param geometry: A valid ``GeoJSON`` object. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.search.models.GeoJsonObject + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchInsideGeometryRequest, self).__init__(**kwargs) + self.geometry = kwargs.get('geometry', None) + + +class SearchSummary(msrest.serialization.Model): + """Summary object for a Search API response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar query: The query parameter that was used to produce these search results. + :vartype query: str + :ivar query_type: The type of query being returned: NEARBY or NON_NEAR. Possible values + include: "NEARBY", "NON_NEAR". + :vartype query_type: str or ~azure.maps.search.models.QueryType + :ivar query_time: Time spent resolving the query, in milliseconds. + :vartype query_time: int + :ivar num_results: Number of results in the response. + :vartype num_results: int + :ivar top: Maximum number of responses that will be returned. + :vartype top: int + :ivar skip: The starting offset of the returned Results within the full Result set. + :vartype skip: int + :ivar total_results: The total number of Results found. + :vartype total_results: int + :ivar fuzzy_level: The maximum fuzzy level required to provide Results. + :vartype fuzzy_level: int + :ivar geo_bias: Indication when the internal search engine has applied a geospatial bias to + improve the ranking of results. In some methods, this can be affected by setting the lat and + lon parameters where available. In other cases it is purely internal. + :vartype geo_bias: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _validation = { + 'query': {'readonly': True}, + 'query_type': {'readonly': True}, + 'query_time': {'readonly': True}, + 'num_results': {'readonly': True}, + 'top': {'readonly': True}, + 'skip': {'readonly': True}, + 'total_results': {'readonly': True}, + 'fuzzy_level': {'readonly': True}, + 'geo_bias': {'readonly': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + 'query_time': {'key': 'queryTime', 'type': 'int'}, + 'num_results': {'key': 'numResults', 'type': 'int'}, + 'top': {'key': 'limit', 'type': 'int'}, + 'skip': {'key': 'offset', 'type': 'int'}, + 'total_results': {'key': 'totalResults', 'type': 'int'}, + 'fuzzy_level': {'key': 'fuzzyLevel', 'type': 'int'}, + 'geo_bias': {'key': 'geoBias', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchSummary, self).__init__(**kwargs) + self.query = None + self.query_type = None + self.query_time = None + self.num_results = None + self.top = None + self.skip = None + self.total_results = None + self.fuzzy_level = None + self.geo_bias = None + + +class Viewport(msrest.serialization.Model): + """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. + + :param top_left_point: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type top_left_point: ~azure.maps.search.models.LatLongPairAbbreviated + :param btm_right_point: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type btm_right_point: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'top_left_point': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, + 'btm_right_point': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(Viewport, self).__init__(**kwargs) + self.top_left_point = kwargs.get('top_left_point', None) + self.btm_right_point = kwargs.get('btm_right_point', None) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/_models_py3.py b/sdk/maps/azure-maps-search/azure/maps/search/models/_models_py3.py new file mode 100644 index 000000000000..7eecb58c837e --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_models_py3.py @@ -0,0 +1,2242 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._search_client_enums import * + + +class Address(msrest.serialization.Model): + """The address of the result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar building_number: The building number on the street. DEPRECATED, use streetNumber instead. + :vartype building_number: str + :ivar street: The street name. DEPRECATED, use streetName instead. + :vartype street: str + :ivar cross_street: The name of the street being crossed. + :vartype cross_street: str + :ivar street_number: The building number on the street. + :vartype street_number: str + :ivar route_numbers: The codes used to unambiguously identify the street. + :vartype route_numbers: list[int] + :ivar street_name: The street name. + :vartype street_name: str + :ivar street_name_and_number: The street name and number. + :vartype street_name_and_number: str + :ivar municipality: City / Town. + :vartype municipality: str + :ivar municipality_subdivision: Sub / Super City. + :vartype municipality_subdivision: str + :ivar country_tertiary_subdivision: Named Area. + :vartype country_tertiary_subdivision: str + :ivar country_secondary_subdivision: County. + :vartype country_secondary_subdivision: str + :ivar country_subdivision: State or Province. + :vartype country_subdivision: str + :ivar postal_code: Postal Code / Zip Code. + :vartype postal_code: str + :ivar extended_postal_code: Extended postal code (availability is dependent on the region). + :vartype extended_postal_code: str + :ivar country_code: Country (Note: This is a two-letter code, not a country name.). + :vartype country_code: str + :ivar country: Country name. + :vartype country: str + :ivar country_code_iso3: ISO alpha-3 country code. + :vartype country_code_iso3: str + :ivar freeform_address: An address line formatted according to the formatting rules of a + Result's country of origin, or in the case of a country, its full country name. + :vartype freeform_address: str + :ivar country_subdivision_name: The full name of a first level of country administrative + hierarchy. This field appears only in case countrySubdivision is presented in an abbreviated + form. Only supported for USA, Canada, and Great Britain. + :vartype country_subdivision_name: str + :ivar local_name: An address component which represents the name of a geographic area or + locality that groups a number of addressable objects for addressing purposes, without being an + administrative unit. This field is used to build the ``freeformAddress`` property. + :vartype local_name: str + :ivar bounding_box: Bounding box coordinates. + :vartype bounding_box: any + """ + + _validation = { + 'building_number': {'readonly': True}, + 'street': {'readonly': True}, + 'cross_street': {'readonly': True}, + 'street_number': {'readonly': True}, + 'route_numbers': {'readonly': True}, + 'street_name': {'readonly': True}, + 'street_name_and_number': {'readonly': True}, + 'municipality': {'readonly': True}, + 'municipality_subdivision': {'readonly': True}, + 'country_tertiary_subdivision': {'readonly': True}, + 'country_secondary_subdivision': {'readonly': True}, + 'country_subdivision': {'readonly': True}, + 'postal_code': {'readonly': True}, + 'extended_postal_code': {'readonly': True}, + 'country_code': {'readonly': True}, + 'country': {'readonly': True}, + 'country_code_iso3': {'readonly': True}, + 'freeform_address': {'readonly': True}, + 'country_subdivision_name': {'readonly': True}, + 'local_name': {'readonly': True}, + 'bounding_box': {'readonly': True}, + } + + _attribute_map = { + 'building_number': {'key': 'buildingNumber', 'type': 'str'}, + 'street': {'key': 'street', 'type': 'str'}, + 'cross_street': {'key': 'crossStreet', 'type': 'str'}, + 'street_number': {'key': 'streetNumber', 'type': 'str'}, + 'route_numbers': {'key': 'routeNumbers', 'type': '[int]'}, + 'street_name': {'key': 'streetName', 'type': 'str'}, + 'street_name_and_number': {'key': 'streetNameAndNumber', 'type': 'str'}, + 'municipality': {'key': 'municipality', 'type': 'str'}, + 'municipality_subdivision': {'key': 'municipalitySubdivision', 'type': 'str'}, + 'country_tertiary_subdivision': {'key': 'countryTertiarySubdivision', 'type': 'str'}, + 'country_secondary_subdivision': {'key': 'countrySecondarySubdivision', 'type': 'str'}, + 'country_subdivision': {'key': 'countrySubdivision', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'extended_postal_code': {'key': 'extendedPostalCode', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'country_code_iso3': {'key': 'countryCodeISO3', 'type': 'str'}, + 'freeform_address': {'key': 'freeformAddress', 'type': 'str'}, + 'country_subdivision_name': {'key': 'countrySubdivisionName', 'type': 'str'}, + 'local_name': {'key': 'localName', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(Address, self).__init__(**kwargs) + self.building_number = None + self.street = None + self.cross_street = None + self.street_number = None + self.route_numbers = None + self.street_name = None + self.street_name_and_number = None + self.municipality = None + self.municipality_subdivision = None + self.country_tertiary_subdivision = None + self.country_secondary_subdivision = None + self.country_subdivision = None + self.postal_code = None + self.extended_postal_code = None + self.country_code = None + self.country = None + self.country_code_iso3 = None + self.freeform_address = None + self.country_subdivision_name = None + self.local_name = None + self.bounding_box = None + + +class AddressRanges(msrest.serialization.Model): + """Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included. + + :param range_left: Address range on the left side of the street. + :type range_left: str + :param range_right: Address range on the right side of the street. + :type range_right: str + :param from_property: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type from_property: ~azure.maps.search.models.LatLongPairAbbreviated + :param to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. + :type to: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'range_left': {'key': 'rangeLeft', 'type': 'str'}, + 'range_right': {'key': 'rangeRight', 'type': 'str'}, + 'from_property': {'key': 'from', 'type': 'LatLongPairAbbreviated'}, + 'to': {'key': 'to', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + range_left: Optional[str] = None, + range_right: Optional[str] = None, + from_property: Optional["LatLongPairAbbreviated"] = None, + to: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(AddressRanges, self).__init__(**kwargs) + self.range_left = range_left + self.range_right = range_right + self.from_property = from_property + self.to = to + + +class BatchRequest(msrest.serialization.Model): + """This type represents the request body for the Batch service. + + :param batch_items: The list of queries to process. + :type batch_items: list[~azure.maps.search.models.BatchRequestItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestItem]'}, + } + + def __init__( + self, + *, + batch_items: Optional[List["BatchRequestItem"]] = None, + **kwargs + ): + super(BatchRequest, self).__init__(**kwargs) + self.batch_items = batch_items + + +class BatchRequestItem(msrest.serialization.Model): + """Batch request object. + + :param query: This parameter contains a query string used to perform an unstructured geocoding + operation. The query string will be passed verbatim to the search API for processing. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + *, + query: Optional[str] = None, + **kwargs + ): + super(BatchRequestItem, self).__init__(**kwargs) + self.query = query + + +class BatchResult(msrest.serialization.Model): + """This object is returned from a successful Batch service call. Extend with 'batchItems' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + """ + + _validation = { + 'batch_summary': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResult, self).__init__(**kwargs) + self.batch_summary = None + + +class BatchResultItem(msrest.serialization.Model): + """An item returned from Batch API. Extend with 'response' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchResultSummary(msrest.serialization.Model): + """Summary of the results for the batch request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_requests: Number of successful requests in the batch. + :vartype successful_requests: int + :ivar total_requests: Total number of requests in the batch. + :vartype total_requests: int + """ + + _validation = { + 'successful_requests': {'readonly': True}, + 'total_requests': {'readonly': True}, + } + + _attribute_map = { + 'successful_requests': {'key': 'successfulRequests', 'type': 'int'}, + 'total_requests': {'key': 'totalRequests', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class BoundingBox(msrest.serialization.Model): + """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. + + :param top_left: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type top_left: ~azure.maps.search.models.LatLongPairAbbreviated + :param bottom_right: A location represented as a latitude and longitude using short names 'lat' + & 'lon'. + :type bottom_right: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'top_left': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, + 'bottom_right': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + top_left: Optional["LatLongPairAbbreviated"] = None, + bottom_right: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(BoundingBox, self).__init__(**kwargs) + self.top_left = top_left + self.bottom_right = bottom_right + + +class BrandName(msrest.serialization.Model): + """The name of the brand for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the brand. + :vartype name: str + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BrandName, self).__init__(**kwargs) + self.name = None + + +class Classification(msrest.serialization.Model): + """The classification for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code property. + :vartype code: str + :ivar names: Names array. + :vartype names: list[~azure.maps.search.models.ClassificationName] + """ + + _validation = { + 'code': {'readonly': True}, + 'names': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'names': {'key': 'names', 'type': '[ClassificationName]'}, + } + + def __init__( + self, + **kwargs + ): + super(Classification, self).__init__(**kwargs) + self.code = None + self.names = None + + +class ClassificationName(msrest.serialization.Model): + """Name for the classification. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_locale: Name Locale property. + :vartype name_locale: str + :ivar name: Name property. + :vartype name: str + """ + + _validation = { + 'name_locale': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name_locale': {'key': 'nameLocale', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClassificationName, self).__init__(**kwargs) + self.name_locale = None + self.name = None + + +class DataSource(msrest.serialization.Model): + """Optional section. Reference ids for use with the `Get Search Polygon `_ API. + + :param geometry: Information about the geometric shape of the result. Only present if type == + Geography. + :type geometry: ~azure.maps.search.models.GeometryIdentifier + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeometryIdentifier'}, + } + + def __init__( + self, + *, + geometry: Optional["GeometryIdentifier"] = None, + **kwargs + ): + super(DataSource, self).__init__(**kwargs) + self.geometry = geometry + + +class EntryPoint(msrest.serialization.Model): + """The entry point for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of entry point. Value can be either *main* or *minor*. Possible values + include: "main", "minor". + :vartype type: str or ~azure.maps.search.models.EntryPointType + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + position: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(EntryPoint, self).__init__(**kwargs) + self.type = None + self.position = position + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.maps.search.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.search.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class GeoJsonFeatureData(msrest.serialization.Model): + """GeoJsonFeatureData. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.search.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + """ + + _validation = { + 'geometry': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + } + + def __init__( + self, + *, + geometry: "GeoJsonGeometry", + properties: Optional[Any] = None, + id: Optional[str] = None, + feature_type: Optional[str] = None, + **kwargs + ): + super(GeoJsonFeatureData, self).__init__(**kwargs) + self.geometry = geometry + self.properties = properties + self.id = id + self.feature_type = feature_type + + +class GeoJsonObject(msrest.serialization.Model): + """A valid ``GeoJSON`` object. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', 'GeoJsonGeometry': 'GeoJsonGeometry'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonObject, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): + """A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.search.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'geometry': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + geometry: "GeoJsonGeometry", + properties: Optional[Any] = None, + id: Optional[str] = None, + feature_type: Optional[str] = None, + **kwargs + ): + super(GeoJsonFeature, self).__init__(geometry=geometry, properties=properties, id=id, feature_type=feature_type, **kwargs) + self.geometry = geometry + self.properties = properties + self.id = id + self.feature_type = feature_type + self.type = 'Feature' # type: str + self.type = 'Feature' # type: str + + +class GeoJsonFeatureCollectionData(msrest.serialization.Model): + """GeoJsonFeatureCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.search.models.GeoJsonFeature] + """ + + _validation = { + 'features': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + } + + def __init__( + self, + *, + features: List["GeoJsonFeature"], + **kwargs + ): + super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.features = features + + +class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.search.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + features: List["GeoJsonFeature"], + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(features=features, **kwargs) + self.features = features + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # type: str + + +class GeoJsonGeometry(GeoJsonObject): + """A valid ``GeoJSON`` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'GeometryCollection': 'GeoJsonGeometryCollection', 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometry, self).__init__(**kwargs) + self.type = 'GeoJsonGeometry' # type: str + + +class GeoJsonGeometryCollectionData(msrest.serialization.Model): + """GeoJsonGeometryCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.search.models.GeoJsonGeometry] + """ + + _validation = { + 'geometries': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + } + + def __init__( + self, + *, + geometries: List["GeoJsonGeometry"], + **kwargs + ): + super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) + self.geometries = geometries + + +class GeoJsonGeometryCollection(GeoJsonGeometry, GeoJsonGeometryCollectionData): + """A valid ``GeoJSON GeometryCollection`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.search.models.GeoJsonGeometry] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'geometries': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + geometries: List["GeoJsonGeometry"], + **kwargs + ): + super(GeoJsonGeometryCollection, self).__init__(geometries=geometries, **kwargs) + self.geometries = geometries + self.type = 'GeometryCollection' # type: str + self.type = 'GeometryCollection' # type: str + + +class GeoJsonLineStringData(msrest.serialization.Model): + """GeoJsonLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonLineStringData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonLineString(GeoJsonGeometry, GeoJsonLineStringData): + """A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonLineString, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'LineString' # type: str + self.type = 'LineString' # type: str + + +class GeoJsonMultiLineStringData(msrest.serialization.Model): + """GeoJsonMultiLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonMultiLineStringData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiLineString(GeoJsonGeometry, GeoJsonMultiLineStringData): + """A valid ``GeoJSON MultiLineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonMultiLineString, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiLineString' # type: str + self.type = 'MultiLineString' # type: str + + +class GeoJsonMultiPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson MultiPoint``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonMultiPointData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiPoint(GeoJsonGeometry, GeoJsonMultiPointData): + """A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonMultiPoint, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiPoint' # type: str + self.type = 'MultiPoint' # type: str + + +class GeoJsonMultiPolygonData(msrest.serialization.Model): + """GeoJsonMultiPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[List[float]]]], + **kwargs + ): + super(GeoJsonMultiPolygonData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiPolygon(GeoJsonGeometry, GeoJsonMultiPolygonData): + """A valid ``GeoJSON MultiPolygon`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[List[float]]]], + **kwargs + ): + super(GeoJsonMultiPolygon, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiPolygon' # type: str + self.type = 'MultiPolygon' # type: str + + +class GeoJsonPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson Point``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + } + + def __init__( + self, + *, + coordinates: List[float], + **kwargs + ): + super(GeoJsonPointData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonPoint(GeoJsonGeometry, GeoJsonPointData): + """A valid ``GeoJSON Point`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[float], + **kwargs + ): + super(GeoJsonPoint, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'Point' # type: str + self.type = 'Point' # type: str + + +class GeoJsonPolygonData(msrest.serialization.Model): + """GeoJsonPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonPolygonData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonPolygon(GeoJsonGeometry, GeoJsonPolygonData): + """A valid ``GeoJSON Polygon`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.search.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonPolygon, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'Polygon' # type: str + self.type = 'Polygon' # type: str + + +class GeometryIdentifier(msrest.serialization.Model): + """Information about the geometric shape of the result. Only present if type == Geography. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Pass this as geometryId to the `Get Search Polygon + `_ API to fetch geometry + information for this result. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeometryIdentifier, self).__init__(**kwargs) + self.id = None + + +class LatLongPairAbbreviated(msrest.serialization.Model): + """A location represented as a latitude and longitude using short names 'lat' & 'lon'. + + :param lat: Latitude property. + :type lat: float + :param lon: Longitude property. + :type lon: float + """ + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + *, + lat: Optional[float] = None, + lon: Optional[float] = None, + **kwargs + ): + super(LatLongPairAbbreviated, self).__init__(**kwargs) + self.lat = lat + self.lon = lon + + +class OperatingHours(msrest.serialization.Model): + """Opening hours for a POI (Points of Interest). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mode: Value used in the request: none or "nextSevenDays". + :vartype mode: str + :ivar time_ranges: List of time ranges for the next 7 days. + :vartype time_ranges: list[~azure.maps.search.models.OperatingHoursTimeRange] + """ + + _validation = { + 'mode': {'readonly': True}, + 'time_ranges': {'readonly': True}, + } + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'time_ranges': {'key': 'timeRanges', 'type': '[OperatingHoursTimeRange]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHours, self).__init__(**kwargs) + self.mode = None + self.time_ranges = None + + +class OperatingHoursTime(msrest.serialization.Model): + """Represents a date and time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar date: Represents current calendar date in POI time zone, e.g. "2019-02-07". + :vartype date: str + :ivar hour: Hours are in the 24 hour format in the local time of a POI; possible values are 0 - + 23. + :vartype hour: int + :ivar minute: Minutes are in the local time of a POI; possible values are 0 - 59. + :vartype minute: int + """ + + _validation = { + 'date': {'readonly': True}, + 'hour': {'readonly': True}, + 'minute': {'readonly': True}, + } + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + 'hour': {'key': 'hour', 'type': 'int'}, + 'minute': {'key': 'minute', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHoursTime, self).__init__(**kwargs) + self.date = None + self.hour = None + self.minute = None + + +class OperatingHoursTimeRange(msrest.serialization.Model): + """Open time range for a day. + + :param start_time: The point in the next 7 days range when a given POI is being opened, or the + beginning of the range if it was opened before the range. + :type start_time: ~azure.maps.search.models.OperatingHoursTime + :param end_time: The point in the next 7 days range when a given POI is being closed, or the + beginning of the range if it was closed before the range. + :type end_time: ~azure.maps.search.models.OperatingHoursTime + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'OperatingHoursTime'}, + 'end_time': {'key': 'endTime', 'type': 'OperatingHoursTime'}, + } + + def __init__( + self, + *, + start_time: Optional["OperatingHoursTime"] = None, + end_time: Optional["OperatingHoursTime"] = None, + **kwargs + ): + super(OperatingHoursTimeRange, self).__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + + +class PointOfInterest(msrest.serialization.Model): + """Details of the returned POI including information such as the name, phone, url address, and classifications. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the POI property. + :vartype name: str + :ivar phone: Telephone number property. + :vartype phone: str + :ivar url: Website URL property. + :vartype url: str + :ivar category_set: The list of the most specific POI categories. + :vartype category_set: list[~azure.maps.search.models.PointOfInterestCategorySet] + :ivar classifications: Classification array. + :vartype classifications: list[~azure.maps.search.models.Classification] + :ivar brands: Brands array. The name of the brand for the POI being returned. + :vartype brands: list[~azure.maps.search.models.BrandName] + :param operating_hours: Opening hours for a POI (Points of Interest). + :type operating_hours: ~azure.maps.search.models.OperatingHours + """ + + _validation = { + 'name': {'readonly': True}, + 'phone': {'readonly': True}, + 'url': {'readonly': True}, + 'category_set': {'readonly': True}, + 'classifications': {'readonly': True}, + 'brands': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'category_set': {'key': 'categorySet', 'type': '[PointOfInterestCategorySet]'}, + 'classifications': {'key': 'classifications', 'type': '[Classification]'}, + 'brands': {'key': 'brands', 'type': '[BrandName]'}, + 'operating_hours': {'key': 'openingHours', 'type': 'OperatingHours'}, + } + + def __init__( + self, + *, + operating_hours: Optional["OperatingHours"] = None, + **kwargs + ): + super(PointOfInterest, self).__init__(**kwargs) + self.name = None + self.phone = None + self.url = None + self.category_set = None + self.classifications = None + self.brands = None + self.operating_hours = operating_hours + + +class PointOfInterestCategory(msrest.serialization.Model): + """POI category result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Unique ID for the category. ID can be used to restrict search results to specific + categories through other Search Service APIs, like `Get Search POI + `_. + :vartype id: int + :ivar name: Name of the category. + :vartype name: str + :ivar child_ids: Array of child category ids. + :vartype child_ids: list[int] + :ivar synonyms: Array of alternative names of the category. + :vartype synonyms: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'child_ids': {'readonly': True}, + 'synonyms': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'child_ids': {'key': 'childCategoryIds', 'type': '[int]'}, + 'synonyms': {'key': 'synonyms', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategory, self).__init__(**kwargs) + self.id = None + self.name = None + self.child_ids = None + self.synonyms = None + + +class PointOfInterestCategorySet(msrest.serialization.Model): + """POI category. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Category ID. + :vartype id: int + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategorySet, self).__init__(**kwargs) + self.id = None + + +class PointOfInterestCategoryTreeResult(msrest.serialization.Model): + """This object is returned from a successful POI Category Tree call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar categories: Categories array. + :vartype categories: list[~azure.maps.search.models.PointOfInterestCategory] + """ + + _validation = { + 'categories': {'readonly': True}, + } + + _attribute_map = { + 'categories': {'key': 'poiCategories', 'type': '[PointOfInterestCategory]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategoryTreeResult, self).__init__(**kwargs) + self.categories = None + + +class Polygon(msrest.serialization.Model): + """Polygon. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider_id: ID of the returned entity. + :vartype provider_id: str + :param geometry_data: Geometry data in GeoJSON format. Please refer to `RFC 7946 + `_ for details. Present only if "error" is not present. + :type geometry_data: ~azure.maps.search.models.GeoJsonObject + """ + + _validation = { + 'provider_id': {'readonly': True}, + } + + _attribute_map = { + 'provider_id': {'key': 'providerID', 'type': 'str'}, + 'geometry_data': {'key': 'geometryData', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + *, + geometry_data: Optional["GeoJsonObject"] = None, + **kwargs + ): + super(Polygon, self).__init__(**kwargs) + self.provider_id = None + self.geometry_data = geometry_data + + +class PolygonResult(msrest.serialization.Model): + """This object is returned from a successful Search Polygon call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar polygons: Results array. + :vartype polygons: list[~azure.maps.search.models.Polygon] + """ + + _validation = { + 'polygons': {'readonly': True}, + } + + _attribute_map = { + 'polygons': {'key': 'additionalData', 'type': '[Polygon]'}, + } + + def __init__( + self, + **kwargs + ): + super(PolygonResult, self).__init__(**kwargs) + self.polygons = None + + +class ReverseSearchAddressBatchItem(BatchResultItem): + """An item returned from Search Address Reverse Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. SearchAddressReverseResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.ReverseSearchAddressBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'ReverseSearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class ReverseSearchAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search Address Reverse call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressResult, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class ReverseSearchAddressBatchItemResponse(ErrorResponse, ReverseSearchAddressResult): + """The result of the query. SearchAddressReverseResponse if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ReverseSearchAddressBatchItemResponse, self).__init__(error=error, **kwargs) + self.summary = None + self.addresses = None + self.error = error + + +class ReverseSearchAddressBatchProcessResult(BatchResult): + """This object is returned from a successful Search Address Reverse Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.ReverseSearchAddressBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[ReverseSearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchProcessResult, self).__init__(**kwargs) + self.batch_items = None + + +class ReverseSearchAddressResultItem(msrest.serialization.Model): + """Result object for a Search Address Reverse response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + :ivar road_use: + :vartype road_use: list[str or ~azure.maps.search.models.RoadUseType] + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". + :vartype match_type: str or ~azure.maps.search.models.MatchType + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + 'road_use': {'readonly': True}, + 'match_type': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'str'}, + 'road_use': {'key': 'roadUse', 'type': '[str]'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressResultItem, self).__init__(**kwargs) + self.address = None + self.position = None + self.road_use = None + self.match_type = None + + +class ReverseSearchCrossStreetAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search Address Reverse CrossStreet call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse Cross Street response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchCrossStreetAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchCrossStreetAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchCrossStreetAddressResult, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class ReverseSearchCrossStreetAddressResultItem(msrest.serialization.Model): + """Result object for a Search Address Reverse Cross Street response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchCrossStreetAddressResultItem, self).__init__(**kwargs) + self.address = None + self.position = None + + +class SearchAddressBatchItem(BatchResultItem): + """An item returned from Search Address Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. SearchAddressResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.SearchAddressBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'SearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search calls. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search API response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressResult, self).__init__(**kwargs) + self.summary = None + self.results = None + + +class SearchAddressBatchItemResponse(ErrorResponse, SearchAddressResult): + """The result of the query. SearchAddressResponse if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search API response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(SearchAddressBatchItemResponse, self).__init__(error=error, **kwargs) + self.summary = None + self.results = None + self.error = error + + +class SearchAddressBatchResult(BatchResult): + """This object is returned from a successful Search Address Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchAddressBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchResult, self).__init__(**kwargs) + self.batch_items = None + + +class SearchAddressResultItem(msrest.serialization.Model): + """Result object for a Search API response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: One of: + + + * POI + * Street + * Geography + * Point Address + * Address Range + * Cross Street. Possible values include: "POI", "Street", "Geography", "Point Address", + "Address Range", "Cross Street". + :vartype type: str or ~azure.maps.search.models.SearchAddressResultType + :ivar id: Id property. + :vartype id: str + :ivar score: The value within a result set to indicate the relative matching score between + results. You can use this to determine that result x is twice as likely to be as relevant as + result y if the value of x is 2x the value of y. The values vary between queries and is only + meant as a relative value for one result set. + :vartype score: float + :ivar distance_in_meters: Straight line distance between the result and geobias location in + meters. + :vartype distance_in_meters: float + :ivar info: Information about the original data source of the Result. Used for support + requests. + :vartype info: str + :param entity_type: Possible values include: "Country", "CountrySubdivision", + "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", + "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :ivar point_of_interest: Details of the returned POI including information such as the name, + phone, url address, and classifications. + :vartype point_of_interest: ~azure.maps.search.models.PointOfInterest + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.LatLongPairAbbreviated + :ivar viewport: The viewport that covers the result represented by the top-left and + bottom-right coordinates of the viewport. + :vartype viewport: ~azure.maps.search.models.BoundingBox + :ivar entry_points: Array of EntryPoints. Those describe the types of entrances available at + the location. The type can be "main" for main entrances such as a front door, or a lobby, and + "minor", for side and back doors. + :vartype entry_points: list[~azure.maps.search.models.EntryPoint] + :ivar address_ranges: Describes the address range on both sides of the street for a search + result. Coordinates for the start and end locations of the address range are included. + :vartype address_ranges: ~azure.maps.search.models.AddressRanges + :ivar data_sources: Optional section. Reference geometry id for use with the `Get Search + Polygon `_ API. + :vartype data_sources: ~azure.maps.search.models.DataSource + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". + :vartype match_type: str or ~azure.maps.search.models.MatchType + :ivar detour_time: Detour time in seconds. Only returned for calls to the Search Along Route + API. + :vartype detour_time: int + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'score': {'readonly': True}, + 'distance_in_meters': {'readonly': True}, + 'info': {'readonly': True}, + 'point_of_interest': {'readonly': True}, + 'address': {'readonly': True}, + 'viewport': {'readonly': True}, + 'entry_points': {'readonly': True}, + 'address_ranges': {'readonly': True}, + 'data_sources': {'readonly': True}, + 'match_type': {'readonly': True}, + 'detour_time': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'distance_in_meters': {'key': 'dist', 'type': 'float'}, + 'info': {'key': 'info', 'type': 'str'}, + 'entity_type': {'key': 'entityType', 'type': 'str'}, + 'point_of_interest': {'key': 'poi', 'type': 'PointOfInterest'}, + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, + 'viewport': {'key': 'viewport', 'type': 'BoundingBox'}, + 'entry_points': {'key': 'entryPoints', 'type': '[EntryPoint]'}, + 'address_ranges': {'key': 'addressRanges', 'type': 'AddressRanges'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSource'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + 'detour_time': {'key': 'detourTime', 'type': 'int'}, + } + + def __init__( + self, + *, + entity_type: Optional[Union[str, "GeographicEntityType"]] = None, + position: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(SearchAddressResultItem, self).__init__(**kwargs) + self.type = None + self.id = None + self.score = None + self.distance_in_meters = None + self.info = None + self.entity_type = entity_type + self.point_of_interest = None + self.address = None + self.position = position + self.viewport = None + self.entry_points = None + self.address_ranges = None + self.data_sources = None + self.match_type = None + self.detour_time = None + + +class SearchAlongRouteRequest(msrest.serialization.Model): + """This type represents the request body for the Search Along Route service. + + :param route: A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 + `_ for details. + :type route: ~azure.maps.search.models.GeoJsonLineString + """ + + _attribute_map = { + 'route': {'key': 'route', 'type': 'GeoJsonLineString'}, + } + + def __init__( + self, + *, + route: Optional["GeoJsonLineString"] = None, + **kwargs + ): + super(SearchAlongRouteRequest, self).__init__(**kwargs) + self.route = route + + +class SearchInsideGeometryRequest(msrest.serialization.Model): + """This type represents the request body for the Search Inside Geometry service. + + :param geometry: A valid ``GeoJSON`` object. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.search.models.GeoJsonObject + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + *, + geometry: Optional["GeoJsonObject"] = None, + **kwargs + ): + super(SearchInsideGeometryRequest, self).__init__(**kwargs) + self.geometry = geometry + + +class SearchSummary(msrest.serialization.Model): + """Summary object for a Search API response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar query: The query parameter that was used to produce these search results. + :vartype query: str + :ivar query_type: The type of query being returned: NEARBY or NON_NEAR. Possible values + include: "NEARBY", "NON_NEAR". + :vartype query_type: str or ~azure.maps.search.models.QueryType + :ivar query_time: Time spent resolving the query, in milliseconds. + :vartype query_time: int + :ivar num_results: Number of results in the response. + :vartype num_results: int + :ivar top: Maximum number of responses that will be returned. + :vartype top: int + :ivar skip: The starting offset of the returned Results within the full Result set. + :vartype skip: int + :ivar total_results: The total number of Results found. + :vartype total_results: int + :ivar fuzzy_level: The maximum fuzzy level required to provide Results. + :vartype fuzzy_level: int + :ivar geo_bias: Indication when the internal search engine has applied a geospatial bias to + improve the ranking of results. In some methods, this can be affected by setting the lat and + lon parameters where available. In other cases it is purely internal. + :vartype geo_bias: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _validation = { + 'query': {'readonly': True}, + 'query_type': {'readonly': True}, + 'query_time': {'readonly': True}, + 'num_results': {'readonly': True}, + 'top': {'readonly': True}, + 'skip': {'readonly': True}, + 'total_results': {'readonly': True}, + 'fuzzy_level': {'readonly': True}, + 'geo_bias': {'readonly': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + 'query_time': {'key': 'queryTime', 'type': 'int'}, + 'num_results': {'key': 'numResults', 'type': 'int'}, + 'top': {'key': 'limit', 'type': 'int'}, + 'skip': {'key': 'offset', 'type': 'int'}, + 'total_results': {'key': 'totalResults', 'type': 'int'}, + 'fuzzy_level': {'key': 'fuzzyLevel', 'type': 'int'}, + 'geo_bias': {'key': 'geoBias', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchSummary, self).__init__(**kwargs) + self.query = None + self.query_type = None + self.query_time = None + self.num_results = None + self.top = None + self.skip = None + self.total_results = None + self.fuzzy_level = None + self.geo_bias = None + + +class Viewport(msrest.serialization.Model): + """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. + + :param top_left_point: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type top_left_point: ~azure.maps.search.models.LatLongPairAbbreviated + :param btm_right_point: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type btm_right_point: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'top_left_point': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, + 'btm_right_point': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + top_left_point: Optional["LatLongPairAbbreviated"] = None, + btm_right_point: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(Viewport, self).__init__(**kwargs) + self.top_left_point = top_left_point + self.btm_right_point = btm_right_point diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/_search_client_enums.py b/sdk/maps/azure-maps-search/azure/maps/search/models/_search_client_enums.py new file mode 100644 index 000000000000..580b063fa8a3 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_search_client_enums.py @@ -0,0 +1,242 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ElectricVehicleConnector(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: These are the standard household connectors for a certain region. They are all AC single phase + #: and the standard Voltage and standard Amperage. + #: + #: See also: `Plug & socket types - World Standards + #: `_. + STANDARD_HOUSEHOLD_COUNTRY_SPECIFIC = "StandardHouseholdCountrySpecific" + #: Type 1 connector as defined in the IEC 62196-2 standard. Also called Yazaki after the original + #: manufacturer or SAE J1772 after the standard that first published it. Mostly used in + #: combination with 120V single phase or up to 240V single phase infrastructure. + IEC62196_TYPE1 = "IEC62196Type1" + #: Type 1 based combo connector as defined in the IEC 62196-3 standard. The connector is based on + #: the Type 1 connector – as defined in the IEC 62196-2 standard – with two additional direct + #: current (DC) contacts to allow DC fast charging. + IEC62196_TYPE1_CCS = "IEC62196Type1CCS" + #: Type 2 connector as defined in the IEC 62196-2 standard. Provided as a cable and plug attached + #: to the charging point. + IEC62196_TYPE2_CABLE_ATTACHED = "IEC62196Type2CableAttached" + #: Type 2 connector as defined in the IEC 62196-2 standard. Provided as a socket set into the + #: charging point. + IEC62196_TYPE2_OUTLET = "IEC62196Type2Outlet" + #: Type 2 based combo connector as defined in the IEC 62196-3 standard. The connector is based on + #: the Type 2 connector – as defined in the IEC 62196-2 standard – with two additional direct + #: current (DC) contacts to allow DC fast charging. + IEC62196_TYPE2_CCS = "IEC62196Type2CCS" + #: Type 3 connector as defined in the IEC 62196-2 standard. Also called Scame after the original + #: manufacturer. Mostly used in combination with up to 240V single phase or up to 420V three phase + #: infrastructure. + IEC62196_TYPE3 = "IEC62196Type3" + #: CHAdeMO connector named after an association formed by the Tokyo Electric Power Company and + #: industrial partners. Because of this is is also known as the TEPCO's connector. It supports + #: fast DC charging. + CHADEMO = "Chademo" + #: Industrial Blue connector is a connector defined in the IEC 60309 standard. It is sometime + #: referred to as by some combination of the standard, the color and the fact that is a single + #: phase connector. The connector usually has the "P+N+E, 6h" configuration. + IEC60309_AC1_PHASE_BLUE = "IEC60309AC1PhaseBlue" + #: Industrial White connector is a DC connector defined in the IEC 60309 standard. + IEC60309_DC_WHITE = "IEC60309DCWhite" + #: The Tesla connector is the regionally specific Tesla Supercharger connector. I.e. it refers to + #: either Tesla's proprietary connector, sometimes referred to as Tesla Port mostly limited to + #: North America or the modified Type 2 (DC over Type 2) in Europe. + TESLA = "Tesla" + +class EntryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of entry point. Value can be either *main* or *minor*. + """ + + MAIN = "main" + MINOR = "minor" + +class GeographicEntityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + COUNTRY = "Country" + COUNTRY_SUBDIVISION = "CountrySubdivision" + COUNTRY_SECONDARY_SUBDIVISION = "CountrySecondarySubdivision" + COUNTRY_TERTIARY_SUBDIVISION = "CountryTertiarySubdivision" + MUNICIPALITY = "Municipality" + MUNICIPALITY_SUBDIVISION = "MunicipalitySubdivision" + NEIGHBOURHOOD = "Neighbourhood" + POSTAL_CODE_AREA = "PostalCodeArea" + +class GeoJsonObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON object types - Point, + MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and + FeatureCollection. + """ + + #: ``GeoJSON Point`` geometry. + GEO_JSON_POINT = "Point" + #: ``GeoJSON MultiPoint`` geometry. + GEO_JSON_MULTI_POINT = "MultiPoint" + #: ``GeoJSON LineString`` geometry. + GEO_JSON_LINE_STRING = "LineString" + #: ``GeoJSON MultiLineString`` geometry. + GEO_JSON_MULTI_LINE_STRING = "MultiLineString" + #: ``GeoJSON Polygon`` geometry. + GEO_JSON_POLYGON = "Polygon" + #: ``GeoJSON MultiPolygon`` geometry. + GEO_JSON_MULTI_POLYGON = "MultiPolygon" + #: ``GeoJSON GeometryCollection`` geometry. + GEO_JSON_GEOMETRY_COLLECTION = "GeometryCollection" + #: ``GeoJSON Feature`` object. + GEO_JSON_FEATURE = "Feature" + #: ``GeoJSON FeatureCollection`` object. + GEO_JSON_FEATURE_COLLECTION = "FeatureCollection" + +class JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +class LocalizedMapView(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: United Arab Emirates (Arabic View). + AE = "AE" + #: Argentina (Argentinian View). + AR = "AR" + #: Bahrain (Arabic View). + BH = "BH" + #: India (Indian View). + IN_ENUM = "IN" + #: Iraq (Arabic View). + IQ = "IQ" + #: Jordan (Arabic View). + JO = "JO" + #: Kuwait (Arabic View). + KW = "KW" + #: Lebanon (Arabic View). + LB = "LB" + #: Morocco (Moroccan View). + MA = "MA" + #: Oman (Arabic View). + OM = "OM" + #: Pakistan (Pakistani View). + PK = "PK" + #: Palestinian Authority (Arabic View). + PS = "PS" + #: Qatar (Arabic View). + QA = "QA" + #: Saudi Arabia (Arabic View). + SA = "SA" + #: Syria (Arabic View). + SY = "SY" + #: Yemen (Arabic View). + YE = "YE" + #: Return the map data based on the IP address of the request. + AUTO = "Auto" + #: Unified View (Others). + UNIFIED = "Unified" + +class MatchType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Types of match for a reverse address search operation. + """ + + ADDRESS_POINT = "AddressPoint" + HOUSE_NUMBER_RANGE = "HouseNumberRange" + STREET = "Street" + +class OperatingHoursRange(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Shows the hours of operation for the next week, starting with the current day in the local time + #: of the POI. + NEXT_SEVEN_DAYS = "nextSevenDays" + +class PointOfInterestExtendedPostalCodes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + POI = "POI" + NONE = "None" + +class QueryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of query being returned: NEARBY or NON_NEAR. + """ + + #: Search was performed around a certain latitude and longitude with a defined radius. + NEARBY = "NEARBY" + #: Search was performed globally, without biasing to a certain latitude and longitude, and no + #: defined radius. + GLOBAL_ENUM = "NON_NEAR" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" + +class RoadUseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the possible uses of a road. + """ + + LIMITED_ACCESS = "LimitedAccess" + ARTERIAL = "Arterial" + TERMINAL = "Terminal" + RAMP = "Ramp" + ROTARY = "Rotary" + LOCAL_STREET = "LocalStreet" + +class SearchAddressResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """One of: + + + * POI + * Street + * Geography + * Point Address + * Address Range + * Cross Street + """ + + POI = "POI" + STREET = "Street" + GEOGRAPHY = "Geography" + POINT_ADDRESS = "Point Address" + ADDRESS_RANGE = "Address Range" + CROSS_STREET = "Cross Street" + +class SearchIndexes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Address range interpolation. + ADDRESS = "Addr" + #: Geographies. + GEOGRAPHIES = "Geo" + #: Point Addresses. + POINT_ADDRESSES = "PAD" + #: Points of interest. + POINTS_OF_INTEREST = "POI" + #: Streets. + STREETS = "Str" + #: Cross Streets (Intersections). + CROSS_STREETS = "Xstr" diff --git a/sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py new file mode 100644 index 000000000000..c7f640e252e1 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._search_operations import SearchOperations + +__all__ = [ + 'SearchOperations', +] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/operations/_search_operations.py b/sdk/maps/azure-maps-search/azure/maps/search/operations/_search_operations.py new file mode 100644 index 000000000000..ad0e41aa5e03 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/operations/_search_operations.py @@ -0,0 +1,5288 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +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 +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling + +from .. import models as _models + +if TYPE_CHECKING: + # 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]] + +class SearchOperations(object): + """SearchOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_polygon( + self, + geometry_ids, # type: List[str] + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.PolygonResult" + """**Get Polygon** + + **Applies to**\ : S1 pricing tier. + + The Get Polygon service allows you to request the geometry data such as a city or country + outline for a set of entities, previously retrieved from an Online Search request in GeoJSON + format. The geometry ID is returned in the sourceGeometry object under "geometry" and "id" in + either a Search Address or Search Fuzzy call. + + Please note that any geometry ID retrieved from an Online Search endpoint has a limited + lifetime. The client should not store geometry IDs in persistent storage for later referral, + as the stability of these identifiers is not guaranteed for a long period of time. It is + expected that a request to the Polygon method is made within a few minutes of the request to + the Online Search method that provided the ID. The service allows for batch requests up to 20 + identifiers. + + :param geometry_ids: Comma separated list of geometry UUIDs, previously retrieved from an + Online Search request. + :type geometry_ids: list[str] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolygonResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.PolygonResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolygonResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['geometries'] = self._serialize.query("geometry_ids", geometry_ids, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PolygonResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_polygon.metadata = {'url': '/search/polygon/{format}'} # type: ignore + + def fuzzy_search( + self, + query, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + is_type_ahead=None, # type: Optional[bool] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + category_filter=None, # type: Optional[List[int]] + country_filter=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius_in_meters=None, # type: Optional[int] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + min_fuzzy_level=None, # type: Optional[int] + max_fuzzy_level=None, # type: Optional[int] + index_filter=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + brand_filter=None, # type: Optional[List[str]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + entity_type=None, # type: Optional[Union[str, "_models.GeographicEntityType"]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Free Form Search** + + **Applies to**\ : S0 and S1 pricing tiers. + + The basic default API is Free Form Search which handles the most fuzzy of inputs handling any + combination of address or POI tokens. This search API is the canonical 'single line search'. + The Free Form Search API is a seamless combination of POI search and geocoding. The API can + also be weighted with a contextual position (lat./lon. pair), or fully constrained by a + coordinate and radius, or it can be executed more generally without any geo biasing anchor + point.:code:`
`:code:`
`We strongly advise you to use the 'countrySet' parameter to + specify only the countries for which your application needs coverage, as the default behavior + will be to search the entire world, potentially returning unnecessary + results.:code:`
`:code:`
` E.g.: ``countrySet``\ =US,FR :code:`
`:code:`
`Please + see `Search Coverage + `_ for a complete + list of all the supported countries.:code:`
`:code:`
`Most Search queries default to + ``maxFuzzyLevel``\ =2 to gain performance and also reduce unusual results. This new default can + be overridden as needed per request by passing in the query param ``maxFuzzyLevel``\ =3 or 4. + + :param query: The applicable query string (e.g., "seattle", "pizza"). Can *also* be specified + as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, + -122.125679"). Must be properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param min_fuzzy_level: Minimum fuzziness level to be used. Default: 1, minimum: 1 and maximum: + 4 + + + * + Level 1 has no spell checking. + + * + Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to + "restaurant." + + * + Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell + checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" + to "mountain view" matching. + + * + Level 4 doesn’t add any more spell checking functions. + + The search engine will start looking for a match on the level defined by minFuzzyLevel, and + will stop searching at the level specified by maxFuzzyLevel. + :type min_fuzzy_level: int + :param max_fuzzy_level: Maximum fuzziness level to be used. Default: 2, minimum: 1 and maximum: + 4 + + + * + Level 1 has no spell checking. + + * + Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to + "restaurant." + + * + Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell + checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" + to "mountain view" matching. + + * + Level 4 doesn’t add any more spell checking functions. + + The search engine will start looking for a match on the level defined by minFuzzyLevel, and + will stop searching at the level specified by maxFuzzyLevel. + :type max_fuzzy_level: int + :param index_filter: A comma separated list of indexes which should be utilized for the search. + Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = + Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross + Streets (intersections). + :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.fuzzy_search.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if min_fuzzy_level is not None: + query_parameters['minFuzzyLevel'] = self._serialize.query("min_fuzzy_level", min_fuzzy_level, 'int', maximum=4, minimum=1) + if max_fuzzy_level is not None: + query_parameters['maxFuzzyLevel'] = self._serialize.query("max_fuzzy_level", max_fuzzy_level, 'int', maximum=4, minimum=1) + if index_filter is not None: + query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + fuzzy_search.metadata = {'url': '/search/fuzzy/{format}'} # type: ignore + + def search_point_of_interest( + self, + query, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + is_type_ahead=None, # type: Optional[bool] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + category_filter=None, # type: Optional[List[int]] + country_filter=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius_in_meters=None, # type: Optional[int] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.PointOfInterestExtendedPostalCodes"]]] + brand_filter=None, # type: Optional[List[str]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Get POI by Name** + + **Applies to**\ : S0 and S1 pricing tiers. + + Points of Interest (POI) Search allows you to request POI results by name. Search supports + additional query parameters such as language and filtering results by area of interest driven + by country or bounding box. Endpoint will return only POI results matching the query string. + Response includes POI details such as address, coordinate location and category. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks"), must be + properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **POI** = Points of Interest + + Value should be **POI** or **None** to disable extended postal codes. + + By default extended postal codes are included. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.PointOfInterestExtendedPostalCodes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_point_of_interest.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_point_of_interest.metadata = {'url': '/search/poi/{format}'} # type: ignore + + def search_nearby_point_of_interest( + self, + lat, # type: float + lon, # type: float + format="json", # type: Union[str, "_models.ResponseFormat"] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + category_filter=None, # type: Optional[List[int]] + country_filter=None, # type: Optional[List[str]] + radius_in_meters=None, # type: Optional[int] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + brand_filter=None, # type: Optional[List[str]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Nearby Search** + + **Applies to**\ : S0 and S1 pricing tiers. + + If you have a use case for only retrieving POI results around a specific location, the nearby + search method may be the right choice. This endpoint will only return POI results, and does not + take in a search query parameter. + + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area, Min value is 1, Max Value is 50000. + :type radius_in_meters: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_nearby_point_of_interest.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['lat'] = self._serialize.query("lat", lat, 'float') + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_nearby_point_of_interest.metadata = {'url': '/search/nearby/{format}'} # type: ignore + + def search_point_of_interest_category( + self, + query, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + is_type_ahead=None, # type: Optional[bool] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + category_filter=None, # type: Optional[List[int]] + country_filter=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius_in_meters=None, # type: Optional[int] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + brand_filter=None, # type: Optional[List[str]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Get POI by Category** + + **Applies to**\ : S0 and S1 pricing tiers. + + Points of Interest (POI) Category Search allows you to request POI results from given category. + Search allows to query POIs from one category at a time. Endpoint will only return POI results + which are categorized as specified. Response includes POI details such as address, coordinate + location and classification. + + :param query: The POI category to search for (e.g., "AIRPORT", "RESTAURANT"), must be properly + URL encoded. Supported main categories can be requested by calling `Get Search POI Category + Tree API `_. List of available categories can also be + found `here `_. We + recommend to use POI Search Category Tree API to request the supported categories. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_point_of_interest_category.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_point_of_interest_category.metadata = {'url': '/search/poi/category/{format}'} # type: ignore + + def get_point_of_interest_category_tree( + self, + format="json", # type: Union[str, "_models.JsonFormat"] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.PointOfInterestCategoryTreeResult" + """**Get POI Category Tree** + + **Applies to**\ : S0 and S1 pricing tiers. + + POI Category API provides a full list of supported Points of Interest (POI) categories and + subcategories together with their translations and synonyms. The returned content can be used + to provide more meaningful results through other Search Service APIs, like `Get Search POI + `_. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, except NGT and NGT-Latn. Language tag is case insensitive. When + data in specified language is not available for a specific field, default language is used + (English). + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointOfInterestCategoryTreeResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.PointOfInterestCategoryTreeResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointOfInterestCategoryTreeResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_point_of_interest_category_tree.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointOfInterestCategoryTreeResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_point_of_interest_category_tree.metadata = {'url': '/search/poi/category/tree/{format}'} # type: ignore + + def search_address( + self, + query, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + is_type_ahead=None, # type: Optional[bool] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + country_filter=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius_in_meters=None, # type: Optional[int] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + entity_type=None, # type: Optional[Union[str, "_models.GeographicEntityType"]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Address Geocoding** + + **Applies to**\ : S0 and S1 pricing tiers. + + In many cases, the complete search service might be too much, for instance if you are only + interested in traditional geocoding. Search can also be accessed for address look up + exclusively. The geocoding is performed by hitting the geocode endpoint with just the address + or partial address in question. The geocoding search index will be queried for everything above + the street level data. No POIs will be returned. Note that the geocoder is very tolerant of + typos and incomplete addresses. It will also handle everything from exact street addresses or + street or intersections as well as higher level geographies such as city centers, counties, + states etc. + + :param query: The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be + properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_address.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_address.metadata = {'url': '/search/address/{format}'} # type: ignore + + def reverse_search_address( + self, + query, # type: List[float] + format="json", # type: Union[str, "_models.ResponseFormat"] + language=None, # type: Optional[str] + include_speed_limit=None, # type: Optional[bool] + heading=None, # type: Optional[int] + radius_in_meters=None, # type: Optional[int] + number=None, # type: Optional[str] + include_road_use=None, # type: Optional[bool] + road_use=None, # type: Optional[List[Union[str, "_models.RoadUseType"]]] + allow_freeform_newline=None, # type: Optional[bool] + include_match_type=None, # type: Optional[bool] + entity_type=None, # type: Optional[Union[str, "_models.GeographicEntityType"]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.ReverseSearchAddressResult" + """**Reverse Geocode to an Address** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) + into a human understandable street address. Most often this is needed in tracking applications + where you receive a GPS feed from the device or asset and wish to know what address where the + coordinate is located. This endpoint will return address information for a given coordinate. + + :param query: The applicable query specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param include_speed_limit: Boolean. To enable return of the posted speed limit. + :type include_speed_limit: bool + :param heading: The directional heading of the vehicle in degrees, for travel along a segment + of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can + include upto one decimal place. + :type heading: int + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param number: If a number is sent in along with the request, the response may include the side + of the street (Left/Right) and also an offset position for that number. + :type number: str + :param include_road_use: Boolean. To enable return of the road use array for reverse geocodes + at street level. + :type include_road_use: bool + :param road_use: To restrict reverse geocodes to a certain type of road use. The road use array + for reverse geocodes can be one or more of LimitedAccess, Arterial, Terminal, Ramp, Rotary, + LocalStreet. + :type road_use: list[str or ~azure.maps.search.models.RoadUseType] + :param allow_freeform_newline: Format of newlines in the formatted address. + + If true, the address will contain newlines. + If false, newlines will be converted to commas. + :type allow_freeform_newline: bool + :param include_match_type: Include information on the type of match the geocoder achieved in + the response. + :type include_match_type: bool + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.reverse_search_address.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, '[float]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if include_speed_limit is not None: + query_parameters['returnSpeedLimit'] = self._serialize.query("include_speed_limit", include_speed_limit, 'bool') + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if number is not None: + query_parameters['number'] = self._serialize.query("number", number, 'str') + if include_road_use is not None: + query_parameters['returnRoadUse'] = self._serialize.query("include_road_use", include_road_use, 'bool') + if road_use is not None: + query_parameters['roadUse'] = self._serialize.query("road_use", road_use, '[str]', div=',') + if allow_freeform_newline is not None: + query_parameters['allowFreeformNewline'] = self._serialize.query("allow_freeform_newline", allow_freeform_newline, 'bool') + if include_match_type is not None: + query_parameters['returnMatchType'] = self._serialize.query("include_match_type", include_match_type, 'bool') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ReverseSearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_address.metadata = {'url': '/search/address/reverse/{format}'} # type: ignore + + def reverse_search_cross_street_address( + self, + query, # type: List[float] + format="json", # type: Union[str, "_models.ResponseFormat"] + top=None, # type: Optional[int] + heading=None, # type: Optional[int] + radius_in_meters=None, # type: Optional[int] + language=None, # type: Optional[str] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.ReverseSearchCrossStreetAddressResult" + """**Reverse Geocode to a Cross Street** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) + into a human understandable cross street. Most often this is needed in tracking applications + where you receive a GPS feed from the device or asset and wish to know what address where the + coordinate is located. + This endpoint will return cross street information for a given coordinate. + + :param query: The applicable query specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param heading: The directional heading of the vehicle in degrees, for travel along a segment + of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can + include upto one decimal place. + :type heading: int + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchCrossStreetAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchCrossStreetAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchCrossStreetAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.reverse_search_cross_street_address.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, '[float]', div=',') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ReverseSearchCrossStreetAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_cross_street_address.metadata = {'url': '/search/address/reverse/crossStreet/{format}'} # type: ignore + + def search_structured_address( + self, + format="json", # type: Union[str, "_models.ResponseFormat"] + language=None, # type: Optional[str] + country_code="US", # type: Optional[str] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + street_number=None, # type: Optional[str] + street_name=None, # type: Optional[str] + cross_street=None, # type: Optional[str] + municipality=None, # type: Optional[str] + municipality_subdivision=None, # type: Optional[str] + country_tertiary_subdivision=None, # type: Optional[str] + country_secondary_subdivision=None, # type: Optional[str] + country_subdivision=None, # type: Optional[str] + postal_code=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + entity_type=None, # type: Optional[Union[str, "_models.GeographicEntityType"]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Structured Address Geocoding** + + **Applies to**\ : S0 and S1 pricing tiers. + + Azure Address Geocoding can also be accessed for structured address look up exclusively. The + geocoding search index will be queried for everything above the street level data. No POIs + will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. + It will also handle everything from exact street addresses or street or intersections as well + as higher level geographies such as city centers, counties, states etc. + + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param country_code: The 2 or 3 letter `ISO3166-1 + `_ country code portion of an address. E.g. + US. + :type country_code: str + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param street_number: The street number portion of an address. + :type street_number: str + :param street_name: The street name portion of an address. + :type street_name: str + :param cross_street: The cross street name for the structured address. + :type cross_street: str + :param municipality: The municipality portion of an address. + :type municipality: str + :param municipality_subdivision: The municipality subdivision (sub/super city) for the + structured address. + :type municipality_subdivision: str + :param country_tertiary_subdivision: The named area for the structured address. + :type country_tertiary_subdivision: str + :param country_secondary_subdivision: The county for the structured address. + :type country_secondary_subdivision: str + :param country_subdivision: The country subdivision portion of an address. + :type country_subdivision: str + :param postal_code: The postal code portion of an address. + :type postal_code: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.search_structured_address.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if country_code is not None: + query_parameters['countryCode'] = self._serialize.query("country_code", country_code, 'str') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if street_number is not None: + query_parameters['streetNumber'] = self._serialize.query("street_number", street_number, 'str') + if street_name is not None: + query_parameters['streetName'] = self._serialize.query("street_name", street_name, 'str') + if cross_street is not None: + query_parameters['crossStreet'] = self._serialize.query("cross_street", cross_street, 'str') + if municipality is not None: + query_parameters['municipality'] = self._serialize.query("municipality", municipality, 'str') + if municipality_subdivision is not None: + query_parameters['municipalitySubdivision'] = self._serialize.query("municipality_subdivision", municipality_subdivision, 'str') + if country_tertiary_subdivision is not None: + query_parameters['countryTertiarySubdivision'] = self._serialize.query("country_tertiary_subdivision", country_tertiary_subdivision, 'str') + if country_secondary_subdivision is not None: + query_parameters['countrySecondarySubdivision'] = self._serialize.query("country_secondary_subdivision", country_secondary_subdivision, 'str') + if country_subdivision is not None: + query_parameters['countrySubdivision'] = self._serialize.query("country_subdivision", country_subdivision, 'str') + if postal_code is not None: + query_parameters['postalCode'] = self._serialize.query("postal_code", postal_code, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_structured_address.metadata = {'url': '/search/address/structured/{format}'} # type: ignore + + def search_inside_geometry( + self, + query, # type: str + geometry, # type: "_models.SearchInsideGeometryRequest" + format="json", # type: Union[str, "_models.ResponseFormat"] + top=None, # type: Optional[int] + language=None, # type: Optional[str] + category_filter=None, # type: Optional[List[int]] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + index_filter=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Applies to**\ : S0 and S1 pricing tiers. + + The Search Geometry endpoint allows you to perform a free form search inside a single geometry + or many of them. The search results that fall inside the geometry/geometries will be + returned.:code:`
`:code:`
`To send the geometry you will use a ``POST`` request where the + request body will contain the ``geometry`` object represented as a ``GeoJSON`` type and the + ``Content-Type`` header will be set to ``application/json``. The geographical features to be + searched can be modeled as Polygon and/or Circle geometries represented using any one of the + following ``GeoJSON`` types::code:`
  • **GeoJSON FeatureCollection**
    The `geometry` can + be represented as a `GeoJSON FeatureCollection` object. This is the recommended option if the + geometry contains both Polygons and Circles. The `FeatureCollection` can contain a max of 50 + `GeoJSON Feature` objects. Each `Feature` object should represent either a Polygon or a Circle + with the following conditions:
    • A `Feature` object for the + Polygon geometry can have a max of 50 coordinates and it's properties must be empty.
    • A + `Feature` object for the Circle geometry is composed of a _center_ represented using a `GeoJSON + Point` type and a _radius_ value (in meters) which must be specified in the object's properties + along with the _subType_ property whose value should be 'Circle'.
    `:code:`
    ` Please + see the Examples section below for a sample ``FeatureCollection`` + representation.:code:`
    `:code:`
    `
  • :code:`
  • **GeoJSON GeometryCollection**
    The + `geometry` can be represented as a `GeoJSON GeometryCollection` object. This is the recommended + option if the geometry contains a list of Polygons only. The `GeometryCollection` can contain a + max of 50 `GeoJSON Polygon` objects. Each `Polygon` object can have a max of 50 coordinates. + Please see the Examples section below for a sample `GeometryCollection` + representation.

  • `:code:`
  • **GeoJSON Polygon**
    The `geometry` can be + represented as a `GeoJSON Polygon` object. This is the recommended option if the geometry + contains a single Polygon. The `Polygon` object can have a max of 50 coordinates. Please see + the Examples section below for a sample `Polygon` + representation.

  • `
.:code:`
`:code:`
`. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param geometry: This represents the geometry for one or more geographical features (parks, + state boundary etc.) to search in and should be a GeoJSON compliant type. Please refer to `RFC + 7946 `_ for details. + :type geometry: ~azure.maps.search.models.SearchInsideGeometryRequest + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param index_filter: A comma separated list of indexes which should be utilized for the search. + Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = + Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross + Streets (intersections). + :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.search_inside_geometry.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if index_filter is not None: + query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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(geometry, 'SearchInsideGeometryRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_inside_geometry.metadata = {'url': '/search/geometry/{format}'} # type: ignore + + def search_along_route( + self, + query, # type: str + max_detour_time, # type: int + route, # type: "_models.SearchAlongRouteRequest" + format="json", # type: Union[str, "_models.ResponseFormat"] + top=None, # type: Optional[int] + brand_filter=None, # type: Optional[List[str]] + category_filter=None, # type: Optional[List[int]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Applies to**\ : S0 and S1 pricing tiers. + + The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified + route. This search is constrained by specifying the ``maxDetourTime`` limiting + measure.:code:`
`:code:`
`To send the route-points you will use a ``POST`` request where + the request body will contain the ``route`` object represented as a ``GeoJSON LineString`` type + and the ``Content-Type`` header will be set to ``application/json``. Each route-point in + ``route`` is represented as a ``GeoJSON Position`` type i.e. an array where the *longitude* + value is followed by the *latitude* value and the *altitude* value is ignored. The ``route`` + should contain at least 2 route-points.:code:`
`:code:`
`It is possible that original + route will be altered, some of it's points may be skipped. If the route that passes through the + found point is faster than the original one, the ``detourTime`` value in the response is + negative. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param max_detour_time: Maximum detour time of the point of interest in seconds. Max value is + 3600 seconds. + :type max_detour_time: int + :param route: This represents the route to search along and should be a valid ``GeoJSON + LineString`` type. Please refer to `RFC 7946 + `_ for details. + :type route: ~azure.maps.search.models.SearchAlongRouteRequest + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default value is 10. Max value + is 20. + :type top: int + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.search_along_route.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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['query'] = self._serialize.query("query", query, 'str') + query_parameters['maxDetourTime'] = self._serialize.query("max_detour_time", max_detour_time, 'int', maximum=3600) + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=20) + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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(route, 'SearchAlongRouteRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_along_route.metadata = {'url': '/search/alongRoute/{format}'} # type: ignore + + def fuzzy_search_batch_sync( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressBatchResult" + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of search fuzzy queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.fuzzy_search_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + fuzzy_search_batch_sync.metadata = {'url': '/search/fuzzy/batch/sync/{format}'} # type: ignore + + def _fuzzy_search_batch_initial( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._fuzzy_search_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def begin_fuzzy_search_batch( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResult"] + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of search fuzzy queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._fuzzy_search_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def _get_fuzzy_search_batch_initial( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self._get_fuzzy_search_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def begin_get_fuzzy_search_batch( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResult"] + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._get_fuzzy_search_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_get_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def search_address_batch_sync( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressBatchResult" + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of address geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_address_batch_sync.metadata = {'url': '/search/address/batch/sync/{format}'} # type: ignore + + def _search_address_batch_initial( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def begin_search_address_batch( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResult"] + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of address geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._search_address_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def _get_search_address_batch_initial( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self._get_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def begin_get_search_address_batch( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResult"] + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._get_search_address_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_get_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def reverse_search_address_batch_sync( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.ReverseSearchAddressBatchProcessResult" + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of reverse geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchAddressBatchProcessResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchAddressBatchProcessResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.reverse_search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_address_batch_sync.metadata = {'url': '/search/address/reverse/batch/sync/{format}'} # type: ignore + + def _reverse_search_address_batch_initial( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ReverseSearchAddressBatchProcessResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReverseSearchAddressBatchProcessResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._reverse_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("format", format, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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_request, 'BatchRequest') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def begin_reverse_search_address_batch( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ReverseSearchAddressBatchProcessResult"] + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of reverse geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ReverseSearchAddressBatchProcessResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reverse_search_address_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def _get_reverse_search_address_batch_initial( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ReverseSearchAddressBatchProcessResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReverseSearchAddressBatchProcessResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self._get_reverse_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, '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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def begin_get_reverse_search_address_batch( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ReverseSearchAddressBatchProcessResult"] + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ReverseSearchAddressBatchProcessResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._get_reverse_search_address_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_get_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-search/azure/maps/search/py.typed b/sdk/maps/azure-maps-search/azure/maps/search/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/sdk_packaging.toml b/sdk/maps/azure-maps-search/sdk_packaging.toml new file mode 100644 index 000000000000..8460703a0925 --- /dev/null +++ b/sdk/maps/azure-maps-search/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-search" +package_nspkg = "azure-maps-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/maps/azure-maps-search/setup.cfg b/sdk/maps/azure-maps-search/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-search/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-search/setup.py b/sdk/maps/azure-maps-search/setup.py new file mode 100644 index 000000000000..2a2db158393a --- /dev/null +++ b/sdk/maps/azure-maps-search/setup.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-search" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +)