diff --git a/sdk/maps/azure-maps-route/azure/maps/route/_route_client.py b/sdk/maps/azure-maps-route/azure/maps/route/_route_client.py index 8f6f3b168b0b..4359dfe3f464 100644 --- a/sdk/maps/azure-maps-route/azure/maps/route/_route_client.py +++ b/sdk/maps/azure-maps-route/azure/maps/route/_route_client.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- # pylint: disable=unused-import,ungrouped-imports, R0904, C0302 -from typing import Union, Any, List +from typing import Union, Any, List, Tuple from azure.core.tracing.decorator import distributed_trace from azure.core.credentials import AzureKeyCredential, TokenCredential from azure.core.polling import LROPoller @@ -27,15 +27,19 @@ class MapsRouteClient(MapsRouteClientBase): """Azure Maps Route REST APIs. - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential or ~azure.core.credentials.AzureKeyCredential - :keyword str base_url: Supported Maps Services or Language resource base_url - (protocol and hostname, for example: 'https://.mapsservices.azure.com'). - :keyword str client_id: Specifies which account is intended for usage with the Azure AD security model. - It represents a unique ID for the Azure Maps account. + :param credential: + Credential needed for the client to connect to Azure. + :type credential: + ~azure.core.credentials.TokenCredential or ~azure.core.credentials.AzureKeyCredential + :keyword str base_url: + Supported Maps Services or Language resource base_url + (protocol and hostname, for example: 'https://us.atlas.microsoft.com'). + :keyword str client_id: + Specifies which account is intended for usage with the Azure AD security model. + It represents a unique ID for the Azure Maps account. :keyword api_version: - The API version of the service to use for requests. It defaults to the latest service version. - Setting to an older version may result in reduced feature compatibility. + The API version of the service to use for requests. It defaults to the latest service version. + Setting to an older version may result in reduced feature compatibility. :paramtype api_version: str """ @@ -53,7 +57,7 @@ def __init__( @distributed_trace def get_route_directions( self, - route_points: List[LatLon], + route_points: Union[List[LatLon], List[Tuple]], **kwargs: Any ) -> RouteDirections: """ @@ -66,7 +70,7 @@ def get_route_directions( instructions is also available, depending on the options selected. :param route_points: The Coordinate from which the range calculation should start, coordinates as (lat, lon) - :type route_points: List[LatLon] + :type route_points: List[LatLon] or List[Tuple] :keyword supporting_points: A GeoJSON Geometry collection representing sequence of coordinates used as input for route reconstruction and for calculating zero or more alternative routes to this reference route. @@ -302,7 +306,7 @@ def get_route_directions( @distributed_trace def get_route_range( self, - coordinates: LatLon, + coordinates: Union[LatLon, Tuple], **kwargs: Any ) -> RouteRangeResult: @@ -472,44 +476,44 @@ def get_route_range( @distributed_trace def get_route_directions_batch_sync( self, - route_directions_batch_queries: List[str], + queries: List[str], **kwargs: Any ) -> RouteDirectionsBatchResult: """Sends batches of route directions requests. The method return the result directly. - :param route_directions_batch_queries: The list of route directions queries/requests to + :param queries: The list of route directions queries/requests to process. The list can contain a max of 700 queries for async and 100 queries for sync version and must contain at least 1 query. Required. - :type route_directions_batch_queries: List[str] + :type queries: List[str] :return: RouteDirectionsBatchResult - :rtype: ~azure.maps.route.models.RouteDirectionsBatchResult + :rtype: RouteDirectionsBatchResult :raises ~azure.core.exceptions.HttpResponseError: """ batch_items = [{"query": f"?query={query}"} for query - in route_directions_batch_queries] if route_directions_batch_queries else [] - return self._route_client.request_route_directions_batch_sync( + in queries] if queries else [] + result = self._route_client.request_route_directions_batch_sync( format=ResponseFormat.JSON, route_directions_batch_queries={"batch_items": batch_items}, **kwargs ) - + return RouteDirectionsBatchResult(summary=result.batch_summary, items=result.batch_items) @distributed_trace def begin_route_directions_batch( self, - route_directions_batch_queries: List[str], + queries: List[str], **kwargs: Any ) -> LROPoller[RouteDirectionsBatchResult]: """Sends batches of route direction queries. The method returns a poller for retrieving the result later. - :param route_directions_batch_queries: The list of route directions queries/requests to + :param queries: The list of route directions queries/requests to process. The list can contain a max of 700 queries for async and 100 queries for sync version and must contain at least 1 query. Required. - :type route_directions_batch_queries: List[str] + :type queries: List[str] :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 @@ -518,11 +522,11 @@ def begin_route_directions_batch( :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 RouteDirectionsBatchResult - :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteDirectionsBatchResult] + :rtype: ~azure.core.polling.LROPoller[RouteDirectionsBatchResult] :raises ~azure.core.exceptions.HttpResponseError: """ batch_items = [{"query": f"?query={query}"} for query - in route_directions_batch_queries] if route_directions_batch_queries else [] + in queries] if queries else [] poller = self._route_client.begin_request_route_directions_batch( format=ResponseFormat.JSON, @@ -552,7 +556,7 @@ def get_route_directions_batch( :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 RouteDirectionsBatchResult - :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteDirectionsBatchResult] + :rtype: ~azure.core.polling.LROPoller[RouteDirectionsBatchResult] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -567,7 +571,7 @@ def get_route_directions_batch( @distributed_trace def get_route_matrix( self, - route_matrix_query: RouteMatrixQuery, + query: RouteMatrixQuery, **kwargs: Any ) -> RouteMatrixResult: @@ -578,12 +582,12 @@ def get_route_matrix( The maximum size of a matrix for this method is 100 (the number of origins multiplied by the number of destinations) - :param route_matrix_query: The matrix of origin and destination coordinates to compute the + :param query: The matrix of origin and destination coordinates to compute the route distance, travel time and other summary for each cell of the matrix based on the input parameters. The minimum and the maximum cell count supported are 1 and **700** for async and **100** for sync respectively. For example, it can be 35 origins and 20 destinations or 25 origins and 25 destinations for async API. Is either a model type or a IO type. Required. - :type route_matrix_query: ~azure.maps.route.models.RouteMatrixQuery or IO + :type query: ~azure.maps.route.models.RouteMatrixQuery or IO :param format: Desired format of the response. Only ``json`` format is supported. "json" Default value is "json". :type format: str or ~azure.maps.route.models.JsonFormat @@ -678,7 +682,7 @@ def get_route_matrix( """ return self._route_client.request_route_matrix_sync( format=ResponseFormat.JSON, - route_matrix_query=route_matrix_query, + route_matrix_query=query, **kwargs ) @@ -686,7 +690,7 @@ def get_route_matrix( @distributed_trace def begin_route_matrix_batch( self, - route_matrix_query: RouteMatrixQuery, + query: RouteMatrixQuery, **kwargs: Any ) -> LROPoller[RouteMatrixResult]: @@ -697,12 +701,12 @@ def begin_route_matrix_batch( The maximum size of a matrix for this method is 700 (the number of origins multiplied by the number of destinations) - :param route_matrix_query: The matrix of origin and destination coordinates to compute the + :param query: The matrix of origin and destination coordinates to compute the route distance, travel time and other summary for each cell of the matrix based on the input parameters. The minimum and the maximum cell count supported are 1 and **700** for async and **100** for sync respectively. For example, it can be 35 origins and 20 destinations or 25 origins and 25 destinations for async API. Required. - :type route_matrix_query: ~azure.maps.route.models.RouteMatrixQuery + :type query: ~azure.maps.route.models.RouteMatrixQuery :param format: Desired format of the response. Only ``json`` format is supported. "json" Default value is "json". :type format: str or ~azure.maps.route.models.JsonFormat @@ -805,7 +809,7 @@ def begin_route_matrix_batch( poller = self._route_client.begin_request_route_matrix( format=ResponseFormat.JSON, - route_matrix_query=route_matrix_query, + route_matrix_query=query, **kwargs ) return poller diff --git a/sdk/maps/azure-maps-route/azure/maps/route/aio/_route_client_async.py b/sdk/maps/azure-maps-route/azure/maps/route/aio/_route_client_async.py index 79d2a8ca38a5..ebd02a79a4ea 100644 --- a/sdk/maps/azure-maps-route/azure/maps/route/aio/_route_client_async.py +++ b/sdk/maps/azure-maps-route/azure/maps/route/aio/_route_client_async.py @@ -5,7 +5,7 @@ # -------------------------------------------------------------------------- # pylint: disable=unused-import,ungrouped-imports, R0904, C0302 -from typing import Any, List, Union +from typing import Any, List, Union, Tuple from azure.core.polling import AsyncLROPoller from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.credentials import AzureKeyCredential @@ -28,15 +28,19 @@ # By default, use the latest supported API version class MapsRouteClient(AsyncMapsRouteClientBase): """Azure Maps Route REST APIs. - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential or ~azure.core.credentials.AzureKeyCredential - :keyword str base_url: Supported Maps Services or Language resource base_url - (protocol and hostname, for example: 'https://.mapsservices.azure.com'). - :keyword str client_id: Specifies which account is intended for usage with the Azure AD security model. - It represents a unique ID for the Azure Maps account. + :param credential: + Credential needed for the client to connect to Azure. + :type credential: + ~azure.core.credentials.TokenCredential or ~azure.core.credentials.AzureKeyCredential + :keyword str base_url: + Supported Maps Services or Language resource base_url + (protocol and hostname, for example: 'https://us.atlas.microsoft.com'). + :keyword str client_id: + Specifies which account is intended for usage with the Azure AD security model. + It represents a unique ID for the Azure Maps account. :keyword api_version: - The API version of the service to use for requests. It defaults to the latest service version. - Setting to an older version may result in reduced feature compatibility. + The API version of the service to use for requests. It defaults to the latest service version. + Setting to an older version may result in reduced feature compatibility. :paramtype api_version: str """ @@ -54,7 +58,7 @@ def __init__( @distributed_trace_async async def get_route_directions( self, - route_points: List[LatLon], + route_points: Union[List[LatLon], List[Tuple]], **kwargs: Any ) -> RouteDirections: """ @@ -67,7 +71,7 @@ async def get_route_directions( instructions is also available, depending on the options selected. :param route_points: The Coordinate from which the range calculation should start, coordinates as (lat, lon) - :type route_points: List[LatLon] + :type route_points: List[LatLon] or List[Tuple] :keyword supporting_points: A GeoJSON Geometry collection representing sequence of coordinates used as input for route reconstruction and for calculating zero or more alternative routes to this reference route. @@ -303,7 +307,7 @@ async def get_route_directions( @distributed_trace_async async def get_route_range( self, - coordinates: LatLon, + coordinates: Union[LatLon, Tuple], **kwargs: Any ) -> RouteRangeResult: @@ -473,44 +477,44 @@ async def get_route_range( @distributed_trace_async async def get_route_directions_batch_sync( self, - route_directions_batch_queries: List[str], + queries: List[str], **kwargs: Any ) -> RouteDirectionsBatchResult: """Sends batches of route directions requests. The method return the result directly. - :param route_directions_batch_queries: The list of route directions queries/requests to + :param queries: The list of route directions queries/requests to process. The list can contain a max of 700 queries for async and 100 queries for sync version and must contain at least 1 query. Required. - :type route_directions_batch_queries: List[str] + :type queries: List[str] :return: RouteDirectionsBatchResult - :rtype: ~azure.maps.route.models.RouteDirectionsBatchResult + :rtype: RouteDirectionsBatchResult :raises ~azure.core.exceptions.HttpResponseError: """ batch_items = [{"query": f"?query={query}"} for query - in route_directions_batch_queries] if route_directions_batch_queries else [] - return await self._route_client.request_route_directions_batch_sync( + in queries] if queries else [] + result = await self._route_client.request_route_directions_batch_sync( format=ResponseFormat.JSON, route_directions_batch_queries={"batch_items": batch_items}, **kwargs ) - + return RouteDirectionsBatchResult(summary=result.batch_summary, items=result.batch_items) @distributed_trace_async async def begin_route_directions_batch( self, - route_directions_batch_queries: List[str], + queries: List[str], **kwargs: Any ) -> AsyncLROPoller[RouteDirectionsBatchResult]: """Sends batches of route direction queries. The method returns a poller for retrieving the result later. - :param route_directions_batch_queries: The list of route directions queries/requests to + :param queries: The list of route directions queries/requests to process. The list can contain a max of 700 queries for async and 100 queries for sync version and must contain at least 1 query. Required. - :type route_directions_batch_queries: List[str] + :type queries: List[str] :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 @@ -519,11 +523,11 @@ async def begin_route_directions_batch( :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 RouteDirectionsBatchResult - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteDirectionsBatchResult] + :rtype: ~azure.core.polling.AsyncLROPoller[RouteDirectionsBatchResult] :raises ~azure.core.exceptions.HttpResponseError: """ batch_items = [{"query": f"?query={query}"} for query - in route_directions_batch_queries] if route_directions_batch_queries else [] + in queries] if queries else [] poller = await self._route_client.begin_request_route_directions_batch( format=ResponseFormat.JSON, @@ -553,7 +557,7 @@ async def get_route_directions_batch( :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 RouteDirectionsBatchResult - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteDirectionsBatchResult] + :rtype: ~azure.core.polling.AsyncLROPoller[RouteDirectionsBatchResult] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -568,7 +572,7 @@ async def get_route_directions_batch( @distributed_trace_async async def get_route_matrix( self, - route_matrix_query: RouteMatrixQuery, + query: RouteMatrixQuery, **kwargs: Any ) -> RouteMatrixResult: @@ -579,12 +583,12 @@ async def get_route_matrix( The maximum size of a matrix for this method is 100 (the number of origins multiplied by the number of destinations) - :param route_matrix_query: The matrix of origin and destination coordinates to compute the + :param query: The matrix of origin and destination coordinates to compute the route distance, travel time and other summary for each cell of the matrix based on the input parameters. The minimum and the maximum cell count supported are 1 and **700** for async and **100** for sync respectively. For example, it can be 35 origins and 20 destinations or 25 origins and 25 destinations for async API. Is either a model type or a IO type. Required. - :type route_matrix_query: ~azure.maps.route.models.RouteMatrixQuery or IO + :type query: ~azure.maps.route.models.RouteMatrixQuery or IO :param format: Desired format of the response. Only ``json`` format is supported. "json" Default value is "json". :type format: str or ~azure.maps.route.models.JsonFormat @@ -679,7 +683,7 @@ async def get_route_matrix( """ return await self._route_client.request_route_matrix_sync( format=ResponseFormat.JSON, - route_matrix_query=route_matrix_query, + route_matrix_query=query, **kwargs ) @@ -687,7 +691,7 @@ async def get_route_matrix( @distributed_trace_async async def begin_route_matrix_batch( self, - route_matrix_query: RouteMatrixQuery, + query: RouteMatrixQuery, **kwargs: Any ) -> AsyncLROPoller[RouteMatrixResult]: @@ -698,12 +702,12 @@ async def begin_route_matrix_batch( The maximum size of a matrix for this method is 700 (the number of origins multiplied by the number of destinations) - :param route_matrix_query: The matrix of origin and destination coordinates to compute the + :param query: The matrix of origin and destination coordinates to compute the route distance, travel time and other summary for each cell of the matrix based on the input parameters. The minimum and the maximum cell count supported are 1 and **700** for async and **100** for sync respectively. For example, it can be 35 origins and 20 destinations or 25 origins and 25 destinations for async API. Required. - :type route_matrix_query: ~azure.maps.route.models.RouteMatrixQuery + :type query: ~azure.maps.route.models.RouteMatrixQuery :param format: Desired format of the response. Only ``json`` format is supported. "json" Default value is "json". :type format: str or ~azure.maps.route.models.JsonFormat @@ -806,7 +810,7 @@ async def begin_route_matrix_batch( poller = await self._route_client.begin_request_route_matrix( format=ResponseFormat.JSON, - route_matrix_query=route_matrix_query, + route_matrix_query=query, **kwargs ) return poller diff --git a/sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py b/sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py index 385684c9e14e..dbbe2f267778 100644 --- a/sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py @@ -19,7 +19,6 @@ RouteMatrixSummary, RouteDirectionsBatchItem, RouteOptimizedWaypoint, - RouteLeg, RouteSummary, RouteSection, RouteGuidance, @@ -42,7 +41,8 @@ GeoJsonObjectType, GeoJsonGeometryCollection, RouteDirectionsBatchResult, - RouteDirectionsBatchItem + RouteDirectionsBatchItem, + RouteLeg ) diff --git a/sdk/maps/azure-maps-route/azure/maps/route/models/_models.py b/sdk/maps/azure-maps-route/azure/maps/route/models/_models.py index b167a32324b8..dabdde5bcc87 100644 --- a/sdk/maps/azure-maps-route/azure/maps/route/models/_models.py +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/_models.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ -# pylint: disable=unused-import,ungrouped-imports +# pylint: disable=unused-import,ungrouped-imports, super-init-not-called from typing import List, Optional, Union, NamedTuple from enum import Enum, EnumMeta from six import with_metaclass @@ -11,7 +11,9 @@ from azure.core import CaseInsensitiveEnumMeta from .._generated.models import ( - BatchResult as GenBatchResult + BatchResult as GenBatchResult, + RouteLeg as GenRouteLeg, + BatchResultSummary ) class LatLon(NamedTuple): @@ -42,6 +44,66 @@ class BoundingBox(NamedTuple): east: float = 0.0 north: float = 0.0 +class RouteDirectionsBatchItem(object): + """An item returned from Route Directions Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar response: The result of the query. RouteDirections if the query completed successfully, + ErrorResponse otherwise. + :vartype response: ~azure.maps.route.models.RouteDirectionsBatchItemResponse + """ + + _validation = { + "response": {"readonly": True}, + } + + _attribute_map = { + "response": {"key": "response", "type": "RouteDirectionsBatchItemResponse"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.response = None + +class RouteDirectionsBatchResult(GenBatchResult): + """This object is returned from a successful Route Directions Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :keyword summary: Summary of the results for the batch request. + :paramtype summary: ~azure.maps.route.models.BatchResultSummary + :keyword items: Array containing the batch results. + :paramtype items: list[RouteDirectionsBatchItem] + """ + def __init__( + self, + summary: BatchResultSummary = None, + items: List[RouteDirectionsBatchItem] = None + ): + self.summary = summary + self.items = items + +class RouteLeg(GenRouteLeg): + """A description of a part of a route, comprised of a list of points. + Each additional waypoint provided in the request will result in an additional + leg in the returned route. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for route section. + :vartype summary: ~azure.maps.route.models.RouteLegSummary + :ivar points: Points array. + :vartype points: list[LatLon] + """ + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.summary = None + self.points = None + class GeoJsonObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and @@ -746,52 +808,3 @@ def __init__( super(GeoJsonPolygon, self).__init__(coordinates=coordinates, **kwargs) self.coordinates = coordinates self.type = 'Polygon' # type: str - -class RouteDirectionsBatchResult(GenBatchResult): - """This object is returned from a successful Route Directions 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.route.models.BatchResultSummary - :ivar batch_items: Array containing the batch results. - :vartype batch_items: list[RouteDirectionsBatchItem] - """ - - _validation = { - "batch_summary": {"readonly": True}, - "batch_items": {"readonly": True}, - } - - _attribute_map = { - "batch_summary": {"key": "summary", "type": "BatchResultSummary"}, - "batch_items": {"key": "batchItems", "type": "[RouteDirectionsBatchItem]"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.batch_items = None - -class RouteDirectionsBatchItem(object): - """An item returned from Route Directions Batch service call. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar response: The result of the query. RouteDirections if the query completed successfully, - ErrorResponse otherwise. - :vartype response: ~azure.maps.route.models.RouteDirectionsBatchItemResponse - """ - - _validation = { - "response": {"readonly": True}, - } - - _attribute_map = { - "response": {"key": "response", "type": "RouteDirectionsBatchItemResponse"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.response = None diff --git a/sdk/maps/azure-maps-route/samples/async_samples/sample_get_route_directions_batch_sync_async.py b/sdk/maps/azure-maps-route/samples/async_samples/sample_get_route_directions_batch_sync_async.py index 03f279183ea3..4cd079eb3089 100644 --- a/sdk/maps/azure-maps-route/samples/async_samples/sample_get_route_directions_batch_sync_async.py +++ b/sdk/maps/azure-maps-route/samples/async_samples/sample_get_route_directions_batch_sync_async.py @@ -31,14 +31,14 @@ async def get_route_directions_batch_sync_async(): async with maps_route_client: result = await maps_route_client.get_route_directions_batch_sync( - route_directions_batch_queries=[ + queries=[ "47.620659,-122.348934:47.610101,-122.342015&travelMode=bicycle&routeType=eco&traffic=false" ] ) print("Get route directions batch sync") - print(result.batch_summary.total_requests) - print(result.batch_items[0].response.routes[0].sections[0]) + print(result.summary.total_requests) + print(result.items[0].response.routes[0].sections[0]) # [END get_route_directions_batch_sync] if __name__ == '__main__': diff --git a/sdk/maps/azure-maps-route/samples/async_samples/sample_get_route_matrix_async.py b/sdk/maps/azure-maps-route/samples/async_samples/sample_get_route_matrix_async.py index 4c1b41a0ea3b..2ce89e02eb03 100644 --- a/sdk/maps/azure-maps-route/samples/async_samples/sample_get_route_matrix_async.py +++ b/sdk/maps/azure-maps-route/samples/async_samples/sample_get_route_matrix_async.py @@ -59,7 +59,7 @@ async def get_route_matrix_async(): } async with maps_route_client: - result = await maps_route_client.get_route_matrix(route_matrix_query=request_obj) + result = await maps_route_client.get_route_matrix(query=request_obj) print("Get Route Matrix with given request object:") print(result.matrix[0][0].response.summary.length_in_meters) diff --git a/sdk/maps/azure-maps-route/samples/sample_get_route_directions_batch_sync.py b/sdk/maps/azure-maps-route/samples/sample_get_route_directions_batch_sync.py index 90ba2b1df0b1..5896e3e387c1 100644 --- a/sdk/maps/azure-maps-route/samples/sample_get_route_directions_batch_sync.py +++ b/sdk/maps/azure-maps-route/samples/sample_get_route_directions_batch_sync.py @@ -28,14 +28,14 @@ def get_route_directions_batch_sync(): maps_route_client = MapsRouteClient(credential=AzureKeyCredential(subscription_key)) result = maps_route_client.get_route_directions_batch_sync( - route_directions_batch_queries=[ + queries=[ "47.620659,-122.348934:47.610101,-122.342015&travelMode=bicycle&routeType=eco&traffic=false" ] ) print("Get route directions batch sync") - print(result.batch_summary.total_requests) - print(result.batch_items[0].response.routes[0].sections[0]) + print(result.summary.total_requests) + print(result.items[0].response.routes[0].sections[0]) # [END get_route_directions_batch_sync] if __name__ == '__main__': diff --git a/sdk/maps/azure-maps-route/samples/sample_get_route_matrix.py b/sdk/maps/azure-maps-route/samples/sample_get_route_matrix.py index bf8023c34a11..496456b4a84b 100644 --- a/sdk/maps/azure-maps-route/samples/sample_get_route_matrix.py +++ b/sdk/maps/azure-maps-route/samples/sample_get_route_matrix.py @@ -57,7 +57,7 @@ def get_route_matrix(): } } - result = maps_route_client.get_route_matrix(route_matrix_query=request_obj) + result = maps_route_client.get_route_matrix(query=request_obj) print("Get Route Matrix with given request object:") print(result.summary) diff --git a/sdk/maps/azure-maps-route/swagger/README.md b/sdk/maps/azure-maps-route/swagger/README.md index 9e9f7305f1c6..76deca8a1b4d 100644 --- a/sdk/maps/azure-maps-route/swagger/README.md +++ b/sdk/maps/azure-maps-route/swagger/README.md @@ -22,9 +22,6 @@ output-folder: ../azure/maps/route/_generated namespace: azure.maps.route package-name: azure-maps-route no-namespace-folders: true -use-extension: - "@autorest/modelerfour": "4.22.3" - license-header: MICROSOFT_MIT_NO_VERSION credential-scopes: https://atlas.microsoft.com/.default clear-output-folder: true @@ -40,3 +37,11 @@ models-mode: msrest show-operations: true only-path-and-body-parameters-positional: true ``` + +```yaml +directive: +- from: swagger-document + where: $.securityDefinitions + transform: | + $["SharedKey"]["in"] = "header"; +``` diff --git a/sdk/maps/azure-maps-route/tests/recordings/test_route_client.pyTestMapsRouteClienttest_get_route_directions.json b/sdk/maps/azure-maps-route/tests/recordings/test_route_client.pyTestMapsRouteClienttest_get_route_directions.json index 72124d016286..e16054afbb2b 100644 --- a/sdk/maps/azure-maps-route/tests/recordings/test_route_client.pyTestMapsRouteClienttest_get_route_directions.json +++ b/sdk/maps/azure-maps-route/tests/recordings/test_route_client.pyTestMapsRouteClienttest_get_route_directions.json @@ -16,14 +16,14 @@ "Cache-Control": "no-transform, no-cache", "Content-Length": "1796", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 11 Oct 2022 11:11:54 GMT", + "Date": "Thu, 13 Oct 2022 00:16:40 GMT", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Cache": "CONFIG_NOCACHE", "X-Content-Type-Options": "nosniff", "x-ms-azuremaps-region": "West US 2", - "X-MSEdge-Ref": "Ref A: 7B89DF8EBC8346149878C728309A3AD6 Ref B: TPE30EDGE0917 Ref C: 2022-10-11T11:11:55Z" + "X-MSEdge-Ref": "Ref A: 2499D855AAAD422CA664F9E5DCEAF235 Ref B: TPE30EDGE0918 Ref C: 2022-10-13T00:16:40Z" }, "ResponseBody": { "formatVersion": "0.0.12", @@ -31,21 +31,21 @@ { "summary": { "lengthInMeters": 1147, - "travelTimeInSeconds": 171, + "travelTimeInSeconds": 129, "trafficDelayInSeconds": 0, "trafficLengthInMeters": 0, - "departureTime": "2022-10-11T13:11:56\u002B02:00", - "arrivalTime": "2022-10-11T13:14:46\u002B02:00" + "departureTime": "2022-10-13T02:16:40\u002B02:00", + "arrivalTime": "2022-10-13T02:18:49\u002B02:00" }, "legs": [ { "summary": { "lengthInMeters": 1147, - "travelTimeInSeconds": 171, + "travelTimeInSeconds": 129, "trafficDelayInSeconds": 0, "trafficLengthInMeters": 0, - "departureTime": "2022-10-11T13:11:56\u002B02:00", - "arrivalTime": "2022-10-11T13:14:46\u002B02:00" + "departureTime": "2022-10-13T02:16:40\u002B02:00", + "arrivalTime": "2022-10-13T02:18:49\u002B02:00" }, "points": [ { diff --git a/sdk/maps/azure-maps-route/tests/recordings/test_route_client.pyTestMapsRouteClienttest_get_route_range.json b/sdk/maps/azure-maps-route/tests/recordings/test_route_client.pyTestMapsRouteClienttest_get_route_range.json index f57c98dd2cb6..5988379863f9 100644 --- a/sdk/maps/azure-maps-route/tests/recordings/test_route_client.pyTestMapsRouteClienttest_get_route_range.json +++ b/sdk/maps/azure-maps-route/tests/recordings/test_route_client.pyTestMapsRouteClienttest_get_route_range.json @@ -14,16 +14,16 @@ "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-transform, no-cache", - "Content-Length": "2199", + "Content-Length": "2195", "Content-Type": "application/json; charset=utf-8", - "Date": "Tue, 11 Oct 2022 11:11:55 GMT", + "Date": "Thu, 13 Oct 2022 00:16:41 GMT", "Pragma": "no-cache", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "Vary": "Accept-Encoding", "X-Cache": "CONFIG_NOCACHE", "X-Content-Type-Options": "nosniff", "x-ms-azuremaps-region": "West US 2", - "X-MSEdge-Ref": "Ref A: EAB5D7CA689A4593B2494AE58A3362B3 Ref B: TPE30EDGE0917 Ref C: 2022-10-11T11:11:56Z" + "X-MSEdge-Ref": "Ref A: 8F5A3CE1E3304FC996D31E50E18B1258 Ref B: TPE30EDGE0918 Ref C: 2022-10-13T00:16:40Z" }, "ResponseBody": { "formatVersion": "0.0.1", @@ -34,204 +34,204 @@ }, "boundary": [ { - "latitude": 52.03715, - "longitude": 5.73477 + "latitude": 52.19343, + "longitude": 5.72585 }, { - "latitude": 52.04517, - "longitude": 5.61911 + "latitude": 52.19378, + "longitude": 5.60227 }, { - "latitude": 52.03647, - "longitude": 5.58487 + "latitude": 52.24224, + "longitude": 5.47546 }, { - "latitude": 51.94774, - "longitude": 5.37826 + "latitude": 52.26774, + "longitude": 5.20307 }, { - "latitude": 52.13074, - "longitude": 5.15106 + "latitude": 52.30604, + "longitude": 5.14534 }, { - "latitude": 52.12133, - "longitude": 5.02667 + "latitude": 52.33373, + "longitude": 4.91255 }, { - "latitude": 52.08072, - "longitude": 4.97841 + "latitude": 52.11988, + "longitude": 4.67653 }, { - "latitude": 51.82621, - "longitude": 4.79056 + "latitude": 52.11056, + "longitude": 4.6471 }, { - "latitude": 51.80414, - "longitude": 4.65038 + "latitude": 51.93177, + "longitude": 4.4399 }, { - "latitude": 51.6359, - "longitude": 4.53425 + "latitude": 51.87002, + "longitude": 4.32523 }, { - "latitude": 51.51126, - "longitude": 4.41346 + "latitude": 51.69725, + "longitude": 4.21751 }, { - "latitude": 51.38193, - "longitude": 4.30126 + "latitude": 51.49769, + "longitude": 3.77494 }, { - "latitude": 50.89997, - "longitude": 4.09664 + "latitude": 51.2102, + "longitude": 3.59263 }, { - "latitude": 50.88799, - "longitude": 4.13681 + "latitude": 50.68885, + "longitude": 3.93768 }, { - "latitude": 50.55448, - "longitude": 4.13705 + "latitude": 50.49589, + "longitude": 3.93722 }, { - "latitude": 50.48669, - "longitude": 4.0222 + "latitude": 50.4538, + "longitude": 3.90252 }, { - "latitude": 50.33703, - "longitude": 4.47447 + "latitude": 50.28611, + "longitude": 4.48031 }, { - "latitude": 50.26629, - "longitude": 4.61923 + "latitude": 50.20208, + "longitude": 4.56647 }, { - "latitude": 50.24469, - "longitude": 4.89991 + "latitude": 50.10755, + "longitude": 4.97366 }, { - "latitude": 50.08278, - "longitude": 5.06715 + "latitude": 50.09283, + "longitude": 5.02918 }, { - "latitude": 50.00138, - "longitude": 5.22303 + "latitude": 49.91769, + "longitude": 5.25036 }, { - "latitude": 50.07651, - "longitude": 5.43211 + "latitude": 49.87977, + "longitude": 5.26519 }, { - "latitude": 49.82141, - "longitude": 5.51431 + "latitude": 49.77595, + "longitude": 5.54465 }, { - "latitude": 49.86207, - "longitude": 5.72069 + "latitude": 49.75803, + "longitude": 5.56317 }, { - "latitude": 49.83665, - "longitude": 5.73839 + "latitude": 49.75706, + "longitude": 5.77634 }, { - "latitude": 50.05381, - "longitude": 5.91501 + "latitude": 49.9233, + "longitude": 5.94205 }, { - "latitude": 50.025, - "longitude": 6.09134 + "latitude": 49.9348, + "longitude": 6.0833 }, { - "latitude": 50.09254, - "longitude": 6.08538 + "latitude": 50.01229, + "longitude": 6.13391 }, { "latitude": 50.08942, "longitude": 6.2758 }, { - "latitude": 49.96413, - "longitude": 6.51415 + "latitude": 49.88837, + "longitude": 6.54512 }, { "latitude": 50.00492, "longitude": 6.6107 }, { - "latitude": 49.99788, - "longitude": 6.75858 + "latitude": 49.94769, + "longitude": 6.8971 }, { - "latitude": 50.38432, - "longitude": 6.65276 + "latitude": 50.22922, + "longitude": 6.68836 }, { - "latitude": 50.36904, - "longitude": 6.79277 + "latitude": 50.22978, + "longitude": 7.00975 }, { - "latitude": 50.33186, - "longitude": 7.29189 + "latitude": 50.16467, + "longitude": 7.59464 }, { - "latitude": 50.33323, - "longitude": 7.51344 + "latitude": 50.34621, + "longitude": 7.63528 }, { - "latitude": 50.46359, - "longitude": 7.35484 + "latitude": 50.44604, + "longitude": 7.79885 }, { - "latitude": 50.98148, - "longitude": 7.77386 + "latitude": 50.83557, + "longitude": 8.01587 }, { - "latitude": 51.20117, - "longitude": 7.38919 + "latitude": 51.067, + "longitude": 7.70357 }, { - "latitude": 51.36634, - "longitude": 7.58209 + "latitude": 51.38747, + "longitude": 7.74341 }, { - "latitude": 51.51736, - "longitude": 7.65597 + "latitude": 51.53296, + "longitude": 7.85994 }, { - "latitude": 51.59279, - "longitude": 7.23798 + "latitude": 51.68222, + "longitude": 7.36076 }, { - "latitude": 51.67618, - "longitude": 7.1163 + "latitude": 51.8553, + "longitude": 7.29545 }, { - "latitude": 51.68029, - "longitude": 6.8068 + "latitude": 52.01617, + "longitude": 7.05678 }, { - "latitude": 51.77922, - "longitude": 6.58063 + "latitude": 51.82713, + "longitude": 6.67268 }, { - "latitude": 51.79552, - "longitude": 6.41812 + "latitude": 51.81133, + "longitude": 6.48424 }, { - "latitude": 51.85295, - "longitude": 6.24138 + "latitude": 51.94915, + "longitude": 6.34863 }, { - "latitude": 51.84264, - "longitude": 6.21842 + "latitude": 52.23839, + "longitude": 6.24098 }, { - "latitude": 51.99416, - "longitude": 6.00031 + "latitude": 52.24021, + "longitude": 6.17566 }, { - "latitude": 52.1081, - "longitude": 5.95431 + "latitude": 52.33411, + "longitude": 6.00979 } ] }