google-maps-routeoptimization 0.1.10__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. google_maps_routeoptimization-0.1.10/google/maps/routeoptimization/gapic_version.py → google_maps_routeoptimization-0.2.0/MANIFEST.in +5 -1
  2. {google_maps_routeoptimization-0.1.10/google_maps_routeoptimization.egg-info → google_maps_routeoptimization-0.2.0}/PKG-INFO +19 -5
  3. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/README.rst +3 -3
  4. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization/__init__.py +12 -0
  5. google_maps_routeoptimization-0.2.0/google/maps/routeoptimization/gapic_version.py +16 -0
  6. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/__init__.py +12 -0
  7. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/gapic_metadata.json +30 -0
  8. google_maps_routeoptimization-0.2.0/google/maps/routeoptimization_v1/gapic_version.py +16 -0
  9. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/async_client.py +271 -14
  10. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/client.py +268 -14
  11. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/base.py +35 -2
  12. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/grpc.py +124 -19
  13. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/grpc_asyncio.py +135 -17
  14. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/rest.py +468 -16
  15. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/rest_base.py +124 -0
  16. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/types/__init__.py +12 -0
  17. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/types/route_optimization_service.py +816 -149
  18. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0/google_maps_routeoptimization.egg-info}/PKG-INFO +19 -5
  19. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google_maps_routeoptimization.egg-info/requires.txt +4 -0
  20. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/setup.py +3 -0
  21. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/tests/unit/gapic/routeoptimization_v1/test_route_optimization.py +1465 -280
  22. google_maps_routeoptimization-0.1.10/MANIFEST.in +0 -25
  23. google_maps_routeoptimization-0.1.10/google/maps/routeoptimization_v1/gapic_version.py +0 -16
  24. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/LICENSE +0 -0
  25. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization/py.typed +0 -0
  26. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/py.typed +0 -0
  27. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/__init__.py +0 -0
  28. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/__init__.py +0 -0
  29. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google/maps/routeoptimization_v1/services/route_optimization/transports/__init__.py +0 -0
  30. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google_maps_routeoptimization.egg-info/SOURCES.txt +0 -0
  31. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google_maps_routeoptimization.egg-info/dependency_links.txt +0 -0
  32. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google_maps_routeoptimization.egg-info/not-zip-safe +0 -0
  33. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/google_maps_routeoptimization.egg-info/top_level.txt +0 -0
  34. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/setup.cfg +0 -0
  35. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/tests/__init__.py +0 -0
  36. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/tests/unit/__init__.py +0 -0
  37. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/tests/unit/gapic/__init__.py +0 -0
  38. {google_maps_routeoptimization-0.1.10 → google_maps_routeoptimization-0.2.0}/tests/unit/gapic/routeoptimization_v1/__init__.py +0 -0
@@ -13,4 +13,8 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- __version__ = "0.1.10" # {x-release-please-version}
16
+ include README.rst LICENSE
17
+ recursive-include google *.py *.pyi *.json *.proto py.typed
18
+ recursive-include tests *
19
+ global-exclude *.py[co]
20
+ global-exclude __pycache__
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: google-maps-routeoptimization
3
- Version: 0.1.10
3
+ Version: 0.2.0
4
4
  Summary: Google Maps Routeoptimization API client library
5
5
  Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-maps-routeoptimization
6
6
  Author: Google LLC
@@ -19,15 +19,29 @@ Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
21
  Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
22
23
  Classifier: Operating System :: OS Independent
23
24
  Classifier: Topic :: Internet
24
25
  Requires-Python: >=3.7
25
26
  License-File: LICENSE
26
27
  Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.1
27
28
  Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
29
+ Requires-Dist: grpcio<2.0.0,>=1.33.2
30
+ Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
28
31
  Requires-Dist: proto-plus<2.0.0,>=1.22.3
29
32
  Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
30
33
  Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2
34
+ Dynamic: author
35
+ Dynamic: author-email
36
+ Dynamic: classifier
37
+ Dynamic: description
38
+ Dynamic: home-page
39
+ Dynamic: license
40
+ Dynamic: license-file
41
+ Dynamic: platform
42
+ Dynamic: requires-dist
43
+ Dynamic: requires-python
44
+ Dynamic: summary
31
45
 
32
46
  Python Client for Route Optimization API
33
47
  ========================================
@@ -92,7 +106,7 @@ Supported Python Versions
92
106
  Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
93
107
  Python.
94
108
 
95
- Python >= 3.7
109
+ Python >= 3.7, including 3.14
96
110
 
97
111
  .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
98
112
  .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
@@ -193,7 +207,7 @@ Code-Based Examples
193
207
 
194
208
  import logging
195
209
 
196
- from google.cloud.translate_v3 import translate
210
+ from google.cloud import library_v1
197
211
 
198
212
  base_logger = logging.getLogger("google")
199
213
  base_logger.addHandler(logging.StreamHandler())
@@ -205,7 +219,7 @@ Code-Based Examples
205
219
 
206
220
  import logging
207
221
 
208
- from google.cloud.translate_v3 import translate
222
+ from google.cloud import library_v1
209
223
 
210
224
  base_logger = logging.getLogger("google.cloud.library_v1")
211
225
  base_logger.addHandler(logging.StreamHandler())
@@ -61,7 +61,7 @@ Supported Python Versions
61
61
  Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
62
62
  Python.
63
63
 
64
- Python >= 3.7
64
+ Python >= 3.7, including 3.14
65
65
 
66
66
  .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
67
67
  .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
@@ -162,7 +162,7 @@ Code-Based Examples
162
162
 
163
163
  import logging
164
164
 
165
- from google.cloud.translate_v3 import translate
165
+ from google.cloud import library_v1
166
166
 
167
167
  base_logger = logging.getLogger("google")
168
168
  base_logger.addHandler(logging.StreamHandler())
@@ -174,7 +174,7 @@ Code-Based Examples
174
174
 
175
175
  import logging
176
176
 
177
- from google.cloud.translate_v3 import translate
177
+ from google.cloud import library_v1
178
178
 
179
179
  base_logger = logging.getLogger("google.cloud.library_v1")
180
180
  base_logger.addHandler(logging.StreamHandler())
@@ -37,8 +37,12 @@ from google.maps.routeoptimization_v1.types.route_optimization_service import (
37
37
  InjectedSolutionConstraint,
38
38
  InputConfig,
39
39
  Location,
40
+ OptimizeToursLongRunningMetadata,
40
41
  OptimizeToursRequest,
41
42
  OptimizeToursResponse,
43
+ OptimizeToursUriMetadata,
44
+ OptimizeToursUriRequest,
45
+ OptimizeToursUriResponse,
42
46
  OptimizeToursValidationError,
43
47
  OutputConfig,
44
48
  RouteModifiers,
@@ -50,7 +54,9 @@ from google.maps.routeoptimization_v1.types.route_optimization_service import (
50
54
  SkippedShipment,
51
55
  TimeWindow,
52
56
  TransitionAttributes,
57
+ Uri,
53
58
  Vehicle,
59
+ VehicleFullness,
54
60
  Waypoint,
55
61
  )
56
62
 
@@ -68,8 +74,12 @@ __all__ = (
68
74
  "InjectedSolutionConstraint",
69
75
  "InputConfig",
70
76
  "Location",
77
+ "OptimizeToursLongRunningMetadata",
71
78
  "OptimizeToursRequest",
72
79
  "OptimizeToursResponse",
80
+ "OptimizeToursUriMetadata",
81
+ "OptimizeToursUriRequest",
82
+ "OptimizeToursUriResponse",
73
83
  "OptimizeToursValidationError",
74
84
  "OutputConfig",
75
85
  "RouteModifiers",
@@ -81,7 +91,9 @@ __all__ = (
81
91
  "SkippedShipment",
82
92
  "TimeWindow",
83
93
  "TransitionAttributes",
94
+ "Uri",
84
95
  "Vehicle",
96
+ "VehicleFullness",
85
97
  "Waypoint",
86
98
  "DataFormat",
87
99
  )
@@ -0,0 +1,16 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ __version__ = "0.2.0" # {x-release-please-version}
@@ -35,8 +35,12 @@ from .types.route_optimization_service import (
35
35
  InjectedSolutionConstraint,
36
36
  InputConfig,
37
37
  Location,
38
+ OptimizeToursLongRunningMetadata,
38
39
  OptimizeToursRequest,
39
40
  OptimizeToursResponse,
41
+ OptimizeToursUriMetadata,
42
+ OptimizeToursUriRequest,
43
+ OptimizeToursUriResponse,
40
44
  OptimizeToursValidationError,
41
45
  OutputConfig,
42
46
  RouteModifiers,
@@ -48,7 +52,9 @@ from .types.route_optimization_service import (
48
52
  SkippedShipment,
49
53
  TimeWindow,
50
54
  TransitionAttributes,
55
+ Uri,
51
56
  Vehicle,
57
+ VehicleFullness,
52
58
  Waypoint,
53
59
  )
54
60
 
@@ -66,8 +72,12 @@ __all__ = (
66
72
  "InjectedSolutionConstraint",
67
73
  "InputConfig",
68
74
  "Location",
75
+ "OptimizeToursLongRunningMetadata",
69
76
  "OptimizeToursRequest",
70
77
  "OptimizeToursResponse",
78
+ "OptimizeToursUriMetadata",
79
+ "OptimizeToursUriRequest",
80
+ "OptimizeToursUriResponse",
71
81
  "OptimizeToursValidationError",
72
82
  "OutputConfig",
73
83
  "RouteModifiers",
@@ -80,6 +90,8 @@ __all__ = (
80
90
  "SkippedShipment",
81
91
  "TimeWindow",
82
92
  "TransitionAttributes",
93
+ "Uri",
83
94
  "Vehicle",
95
+ "VehicleFullness",
84
96
  "Waypoint",
85
97
  )
@@ -19,6 +19,16 @@
19
19
  "methods": [
20
20
  "optimize_tours"
21
21
  ]
22
+ },
23
+ "OptimizeToursLongRunning": {
24
+ "methods": [
25
+ "optimize_tours_long_running"
26
+ ]
27
+ },
28
+ "OptimizeToursUri": {
29
+ "methods": [
30
+ "optimize_tours_uri"
31
+ ]
22
32
  }
23
33
  }
24
34
  },
@@ -34,6 +44,16 @@
34
44
  "methods": [
35
45
  "optimize_tours"
36
46
  ]
47
+ },
48
+ "OptimizeToursLongRunning": {
49
+ "methods": [
50
+ "optimize_tours_long_running"
51
+ ]
52
+ },
53
+ "OptimizeToursUri": {
54
+ "methods": [
55
+ "optimize_tours_uri"
56
+ ]
37
57
  }
38
58
  }
39
59
  },
@@ -49,6 +69,16 @@
49
69
  "methods": [
50
70
  "optimize_tours"
51
71
  ]
72
+ },
73
+ "OptimizeToursLongRunning": {
74
+ "methods": [
75
+ "optimize_tours_long_running"
76
+ ]
77
+ },
78
+ "OptimizeToursUri": {
79
+ "methods": [
80
+ "optimize_tours_uri"
81
+ ]
52
82
  }
53
83
  }
54
84
  }
@@ -0,0 +1,16 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ __version__ = "0.2.0" # {x-release-please-version}
@@ -35,6 +35,7 @@ from google.api_core import retry_async as retries
35
35
  from google.api_core.client_options import ClientOptions
36
36
  from google.auth import credentials as ga_credentials # type: ignore
37
37
  from google.oauth2 import service_account # type: ignore
38
+ import google.protobuf
38
39
 
39
40
  from google.maps.routeoptimization_v1 import gapic_version as package_version
40
41
 
@@ -68,25 +69,24 @@ class RouteOptimizationAsyncClient:
68
69
 
69
70
  Validity of certain types of fields:
70
71
 
71
- - ``google.protobuf.Timestamp``
72
+ - ``google.protobuf.Timestamp``
72
73
 
73
- - Times are in Unix time: seconds since
74
- 1970-01-01T00:00:00+00:00.
75
- - seconds must be in [0, 253402300799], i.e. in
76
- [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
77
- - nanos must be unset or set to 0.
74
+ - Times are in Unix time: seconds since 1970-01-01T00:00:00+00:00.
75
+ - seconds must be in [0, 253402300799], i.e. in
76
+ [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
77
+ - nanos must be unset or set to 0.
78
78
 
79
- - ``google.protobuf.Duration``
79
+ - ``google.protobuf.Duration``
80
80
 
81
- - seconds must be in [0, 253402300799], i.e. in
82
- [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
83
- - nanos must be unset or set to 0.
81
+ - seconds must be in [0, 253402300799], i.e. in
82
+ [1970-01-01T00:00:00+00:00, 9999-12-31T23:59:59+00:00].
83
+ - nanos must be unset or set to 0.
84
84
 
85
- - ``google.type.LatLng``
85
+ - ``google.type.LatLng``
86
86
 
87
- - latitude must be in [-90.0, 90.0].
88
- - longitude must be in [-180.0, 180.0].
89
- - at least one of latitude and longitude must be non-zero.
87
+ - latitude must be in [-90.0, 90.0].
88
+ - longitude must be in [-180.0, 180.0].
89
+ - at least one of latitude and longitude must be non-zero.
90
90
  """
91
91
 
92
92
  _client: RouteOptimizationClient
@@ -563,6 +563,260 @@ class RouteOptimizationAsyncClient:
563
563
  # Done; return the response.
564
564
  return response
565
565
 
566
+ async def optimize_tours_long_running(
567
+ self,
568
+ request: Optional[
569
+ Union[route_optimization_service.OptimizeToursRequest, dict]
570
+ ] = None,
571
+ *,
572
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
573
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
574
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
575
+ ) -> operation_async.AsyncOperation:
576
+ r"""This is a variant of the
577
+ [OptimizeTours][google.maps.routeoptimization.v1.RouteOptimization.OptimizeTours]
578
+ method designed for optimizations with large timeout values. It
579
+ should be preferred over the ``OptimizeTours`` method for
580
+ optimizations that take longer than a few minutes.
581
+
582
+ The returned [long-running
583
+ operation][google.longrunning.Operation] (LRO) will have a name
584
+ of the format ``<parent>/operations/<operation_id>`` and can be
585
+ used to track progress of the computation. The
586
+ [metadata][google.longrunning.Operation.metadata] field type is
587
+ [OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursLongRunningMetadata].
588
+ The [response][google.longrunning.Operation.response] field type
589
+ is
590
+ [OptimizeToursResponse][google.maps.routeoptimization.v1.OptimizeToursResponse],
591
+ if successful.
592
+
593
+ Experimental: See
594
+ https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request
595
+ for more details.
596
+
597
+ .. code-block:: python
598
+
599
+ # This snippet has been automatically generated and should be regarded as a
600
+ # code template only.
601
+ # It will require modifications to work:
602
+ # - It may require correct/in-range values for request initialization.
603
+ # - It may require specifying regional endpoints when creating the service
604
+ # client as shown in:
605
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
606
+ from google.maps import routeoptimization_v1
607
+
608
+ async def sample_optimize_tours_long_running():
609
+ # Create a client
610
+ client = routeoptimization_v1.RouteOptimizationAsyncClient()
611
+
612
+ # Initialize request argument(s)
613
+ request = routeoptimization_v1.OptimizeToursRequest(
614
+ parent="parent_value",
615
+ )
616
+
617
+ # Make the request
618
+ operation = client.optimize_tours_long_running(request=request)
619
+
620
+ print("Waiting for operation to complete...")
621
+
622
+ response = (await operation).result()
623
+
624
+ # Handle the response
625
+ print(response)
626
+
627
+ Args:
628
+ request (Optional[Union[google.maps.routeoptimization_v1.types.OptimizeToursRequest, dict]]):
629
+ The request object. Request to be given to a tour
630
+ optimization solver which defines the
631
+ shipment model to solve as well as
632
+ optimization parameters.
633
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
634
+ should be retried.
635
+ timeout (float): The timeout for this request.
636
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
637
+ sent along with the request as metadata. Normally, each value must be of type `str`,
638
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
639
+ be of type `bytes`.
640
+
641
+ Returns:
642
+ google.api_core.operation_async.AsyncOperation:
643
+ An object representing a long-running operation.
644
+
645
+ The result type for the operation will be :class:`google.maps.routeoptimization_v1.types.OptimizeToursResponse` Response after solving a tour optimization problem containing the routes
646
+ followed by each vehicle, the shipments which have
647
+ been skipped and the overall cost of the solution.
648
+
649
+ """
650
+ # Create or coerce a protobuf request object.
651
+ # - Use the request object if provided (there's no risk of modifying the input as
652
+ # there are no flattened fields), or create one.
653
+ if not isinstance(request, route_optimization_service.OptimizeToursRequest):
654
+ request = route_optimization_service.OptimizeToursRequest(request)
655
+
656
+ # Wrap the RPC method; this adds retry and timeout information,
657
+ # and friendly error handling.
658
+ rpc = self._client._transport._wrapped_methods[
659
+ self._client._transport.optimize_tours_long_running
660
+ ]
661
+
662
+ # Certain fields should be provided within the metadata header;
663
+ # add these here.
664
+ metadata = tuple(metadata) + (
665
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
666
+ )
667
+
668
+ # Validate the universe domain.
669
+ self._client._validate_universe_domain()
670
+
671
+ # Send the request.
672
+ response = await rpc(
673
+ request,
674
+ retry=retry,
675
+ timeout=timeout,
676
+ metadata=metadata,
677
+ )
678
+
679
+ # Wrap the response in an operation future.
680
+ response = operation_async.from_gapic(
681
+ response,
682
+ self._client._transport.operations_client,
683
+ route_optimization_service.OptimizeToursResponse,
684
+ metadata_type=route_optimization_service.OptimizeToursLongRunningMetadata,
685
+ )
686
+
687
+ # Done; return the response.
688
+ return response
689
+
690
+ async def optimize_tours_uri(
691
+ self,
692
+ request: Optional[
693
+ Union[route_optimization_service.OptimizeToursUriRequest, dict]
694
+ ] = None,
695
+ *,
696
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
697
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
698
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
699
+ ) -> operation_async.AsyncOperation:
700
+ r"""This is a variant of the
701
+ [OptimizeToursLongRunning][google.maps.routeoptimization.v1.RouteOptimization.OptimizeToursLongRunning]
702
+ method designed for optimizations with large timeout values and
703
+ large input/output sizes.
704
+
705
+ The client specifies the URI of the ``OptimizeToursRequest``
706
+ stored in Google Cloud Storage and the server writes the
707
+ ``OptimizeToursResponse`` to a client-specified Google Cloud
708
+ Storage URI.
709
+
710
+ This method should be preferred over the ``OptimizeTours``
711
+ method for optimizations that take longer than a few minutes and
712
+ input/output sizes that are larger than 8MB, though it can be
713
+ used for shorter and smaller optimizations as well.
714
+
715
+ The returned [long-running
716
+ operation][google.longrunning.Operation] (LRO) will have a name
717
+ of the format ``<parent>/operations/<operation_id>`` and can be
718
+ used to track progress of the computation. The
719
+ [metadata][google.longrunning.Operation.metadata] field type is
720
+ [OptimizeToursLongRunningMetadata][google.maps.routeoptimization.v1.OptimizeToursUriMetadata].
721
+ The [response][google.longrunning.Operation.response] field type
722
+ is
723
+ [OptimizeToursUriResponse][google.maps.routeoptimization.v1.OptimizeToursUriResponse],
724
+ if successful.
725
+
726
+ Experimental: See
727
+ https://developers.google.com/maps/tt/route-optimization/experimental/otlr/make-request
728
+ for more details.
729
+
730
+ .. code-block:: python
731
+
732
+ # This snippet has been automatically generated and should be regarded as a
733
+ # code template only.
734
+ # It will require modifications to work:
735
+ # - It may require correct/in-range values for request initialization.
736
+ # - It may require specifying regional endpoints when creating the service
737
+ # client as shown in:
738
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
739
+ from google.maps import routeoptimization_v1
740
+
741
+ async def sample_optimize_tours_uri():
742
+ # Create a client
743
+ client = routeoptimization_v1.RouteOptimizationAsyncClient()
744
+
745
+ # Initialize request argument(s)
746
+ request = routeoptimization_v1.OptimizeToursUriRequest(
747
+ parent="parent_value",
748
+ )
749
+
750
+ # Make the request
751
+ operation = client.optimize_tours_uri(request=request)
752
+
753
+ print("Waiting for operation to complete...")
754
+
755
+ response = (await operation).result()
756
+
757
+ # Handle the response
758
+ print(response)
759
+
760
+ Args:
761
+ request (Optional[Union[google.maps.routeoptimization_v1.types.OptimizeToursUriRequest, dict]]):
762
+ The request object. A request used by the ``OptimizeToursUri`` method.
763
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
764
+ should be retried.
765
+ timeout (float): The timeout for this request.
766
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
767
+ sent along with the request as metadata. Normally, each value must be of type `str`,
768
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
769
+ be of type `bytes`.
770
+
771
+ Returns:
772
+ google.api_core.operation_async.AsyncOperation:
773
+ An object representing a long-running operation.
774
+
775
+ The result type for the operation will be
776
+ :class:`google.maps.routeoptimization_v1.types.OptimizeToursUriResponse`
777
+ A response returned by the OptimizeToursUri method.
778
+
779
+ """
780
+ # Create or coerce a protobuf request object.
781
+ # - Use the request object if provided (there's no risk of modifying the input as
782
+ # there are no flattened fields), or create one.
783
+ if not isinstance(request, route_optimization_service.OptimizeToursUriRequest):
784
+ request = route_optimization_service.OptimizeToursUriRequest(request)
785
+
786
+ # Wrap the RPC method; this adds retry and timeout information,
787
+ # and friendly error handling.
788
+ rpc = self._client._transport._wrapped_methods[
789
+ self._client._transport.optimize_tours_uri
790
+ ]
791
+
792
+ # Certain fields should be provided within the metadata header;
793
+ # add these here.
794
+ metadata = tuple(metadata) + (
795
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
796
+ )
797
+
798
+ # Validate the universe domain.
799
+ self._client._validate_universe_domain()
800
+
801
+ # Send the request.
802
+ response = await rpc(
803
+ request,
804
+ retry=retry,
805
+ timeout=timeout,
806
+ metadata=metadata,
807
+ )
808
+
809
+ # Wrap the response in an operation future.
810
+ response = operation_async.from_gapic(
811
+ response,
812
+ self._client._transport.operations_client,
813
+ route_optimization_service.OptimizeToursUriResponse,
814
+ metadata_type=route_optimization_service.OptimizeToursUriMetadata,
815
+ )
816
+
817
+ # Done; return the response.
818
+ return response
819
+
566
820
  async def get_operation(
567
821
  self,
568
822
  request: Optional[operations_pb2.GetOperationRequest] = None,
@@ -629,5 +883,8 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
629
883
  gapic_version=package_version.__version__
630
884
  )
631
885
 
886
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
887
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
888
+
632
889
 
633
890
  __all__ = ("RouteOptimizationAsyncClient",)