stadiamaps 1.0.7__py3-none-any.whl → 2.1.0__py3-none-any.whl
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.
- stadiamaps/__init__.py +6 -24
- stadiamaps/api/geocoding_api.py +1917 -760
- stadiamaps/api/geospatial_api.py +483 -221
- stadiamaps/api/routing_api.py +1615 -723
- stadiamaps/api_client.py +275 -272
- stadiamaps/api_response.py +12 -16
- stadiamaps/configuration.py +13 -11
- stadiamaps/exceptions.py +67 -30
- stadiamaps/models/__init__.py +5 -23
- stadiamaps/models/access.py +44 -26
- stadiamaps/models/admin_region.py +46 -28
- stadiamaps/models/administrative.py +48 -30
- stadiamaps/models/auto_costing_options.py +75 -48
- stadiamaps/models/base_costing_options.py +59 -34
- stadiamaps/models/base_trace_request.py +70 -40
- stadiamaps/models/bicycle_costing_options.py +67 -42
- stadiamaps/models/bike_network.py +42 -24
- stadiamaps/models/contour.py +45 -27
- stadiamaps/models/coordinate.py +45 -26
- stadiamaps/models/costing_model.py +10 -12
- stadiamaps/models/costing_options.py +51 -33
- stadiamaps/models/directions_options.py +45 -27
- stadiamaps/models/distance_unit.py +8 -11
- stadiamaps/models/edge_sign.py +46 -28
- stadiamaps/models/edge_use.py +8 -11
- stadiamaps/models/end_node.py +48 -30
- stadiamaps/models/geo_attributes.py +47 -29
- stadiamaps/models/geo_json_geometry.py +25 -25
- stadiamaps/models/geo_json_geometry_base.py +45 -27
- stadiamaps/models/geo_json_line_string.py +47 -28
- stadiamaps/models/geo_json_line_string_all_of.py +1 -1
- stadiamaps/models/geo_json_point.py +47 -28
- stadiamaps/models/geo_json_point_all_of.py +1 -1
- stadiamaps/models/geo_json_polygon.py +47 -28
- stadiamaps/models/geo_json_polygon_all_of.py +1 -1
- stadiamaps/models/geocoding_object.py +46 -28
- stadiamaps/models/height_request.py +55 -34
- stadiamaps/models/height_response.py +49 -30
- stadiamaps/models/highway_classification.py +52 -34
- stadiamaps/models/intersecting_edge.py +45 -27
- stadiamaps/models/isochrone_costing_model.py +8 -11
- stadiamaps/models/isochrone_feature.py +45 -27
- stadiamaps/models/isochrone_properties.py +48 -30
- stadiamaps/models/isochrone_request.py +54 -35
- stadiamaps/models/isochrone_response.py +47 -29
- stadiamaps/models/locate_detailed_edge.py +73 -55
- stadiamaps/models/locate_edge.py +56 -39
- stadiamaps/models/locate_edge_info.py +47 -29
- stadiamaps/models/locate_node.py +50 -31
- stadiamaps/models/locate_object.py +49 -31
- stadiamaps/models/maneuver_sign.py +50 -32
- stadiamaps/models/maneuver_sign_element.py +45 -27
- stadiamaps/models/map_match_costing_model.py +8 -11
- stadiamaps/models/map_match_request.py +74 -44
- stadiamaps/models/map_match_route_response.py +57 -29
- stadiamaps/models/map_match_trace_options.py +47 -29
- stadiamaps/models/map_match_waypoint.py +49 -30
- stadiamaps/models/matched_point.py +52 -34
- stadiamaps/models/matrix_costing_model.py +9 -12
- stadiamaps/models/matrix_distance.py +46 -28
- stadiamaps/models/matrix_request.py +70 -39
- stadiamaps/models/matrix_response.py +60 -36
- stadiamaps/models/motor_scooter_costing_options.py +76 -49
- stadiamaps/models/motorcycle_costing_options.py +75 -48
- stadiamaps/models/nearest_roads_request.py +65 -34
- stadiamaps/models/node_id.py +42 -24
- stadiamaps/models/node_type.py +8 -11
- stadiamaps/models/optimized_route_request.py +66 -35
- stadiamaps/models/pedestrian_costing_options.py +59 -40
- stadiamaps/models/pelias_geo_json_feature.py +50 -31
- stadiamaps/models/pelias_geo_json_properties.py +54 -36
- stadiamaps/models/pelias_geo_json_properties_addendum.py +43 -25
- stadiamaps/models/pelias_geo_json_properties_addendum_osm.py +42 -24
- stadiamaps/models/pelias_layer.py +8 -11
- stadiamaps/models/pelias_response.py +49 -30
- stadiamaps/models/pelias_source.py +8 -11
- stadiamaps/models/restrictions.py +44 -26
- stadiamaps/models/road_class.py +8 -11
- stadiamaps/models/route_leg.py +48 -29
- stadiamaps/models/route_maneuver.py +73 -55
- stadiamaps/models/route_request.py +76 -43
- stadiamaps/models/route_response.py +56 -28
- stadiamaps/models/route_response_alternates_inner.py +105 -0
- stadiamaps/models/route_summary.py +48 -30
- stadiamaps/models/route_trip.py +135 -0
- stadiamaps/models/routing_response_waypoint.py +49 -30
- stadiamaps/models/routing_waypoint.py +60 -41
- stadiamaps/models/routing_waypoint_all_of_search_filter.py +48 -30
- stadiamaps/models/simple_routing_waypoint.py +48 -29
- stadiamaps/models/speeds.py +49 -31
- stadiamaps/models/trace_attribute_filter_options.py +47 -28
- stadiamaps/models/trace_attribute_key.py +8 -11
- stadiamaps/models/trace_attributes_base_response.py +51 -32
- stadiamaps/models/trace_attributes_request.py +72 -42
- stadiamaps/models/trace_attributes_request_all_of_filters.py +1 -1
- stadiamaps/models/trace_attributes_response.py +54 -35
- stadiamaps/models/trace_edge.py +88 -70
- stadiamaps/models/travel_mode.py +8 -11
- stadiamaps/models/traversability.py +8 -11
- stadiamaps/models/truck_costing_options.py +78 -51
- stadiamaps/models/tz_response.py +45 -27
- stadiamaps/models/valhalla_languages.py +8 -11
- stadiamaps/models/valhalla_long_units.py +8 -11
- stadiamaps/models/warning.py +42 -24
- stadiamaps/py.typed +0 -0
- stadiamaps/rest.py +127 -172
- {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/METADATA +4 -4
- stadiamaps-2.1.0.dist-info/RECORD +128 -0
- {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/WHEEL +1 -1
- stadiamaps-1.0.7.dist-info/RECORD +0 -125
- {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/LICENSE.txt +0 -0
- {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Stadia Maps Geospatial APIs
|
5
|
+
|
6
|
+
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 6.1.0
|
9
|
+
Contact: support@stadiamaps.com
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
|
+
|
12
|
+
Do not edit the class manually.
|
13
|
+
""" # noqa: E501
|
14
|
+
|
15
|
+
|
16
|
+
from __future__ import annotations
|
17
|
+
import pprint
|
18
|
+
import re # noqa: F401
|
19
|
+
import json
|
20
|
+
|
21
|
+
from pydantic import BaseModel, ConfigDict
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from stadiamaps.models.route_trip import RouteTrip
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
class RouteResponseAlternatesInner(BaseModel):
|
28
|
+
"""
|
29
|
+
RouteResponseAlternatesInner
|
30
|
+
""" # noqa: E501
|
31
|
+
trip: Optional[RouteTrip] = None
|
32
|
+
additional_properties: Dict[str, Any] = {}
|
33
|
+
__properties: ClassVar[List[str]] = ["trip"]
|
34
|
+
|
35
|
+
model_config = ConfigDict(
|
36
|
+
populate_by_name=True,
|
37
|
+
validate_assignment=True,
|
38
|
+
protected_namespaces=(),
|
39
|
+
)
|
40
|
+
|
41
|
+
|
42
|
+
def to_str(self) -> str:
|
43
|
+
"""Returns the string representation of the model using alias"""
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
45
|
+
|
46
|
+
def to_json(self) -> str:
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
49
|
+
return json.dumps(self.to_dict())
|
50
|
+
|
51
|
+
@classmethod
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
53
|
+
"""Create an instance of RouteResponseAlternatesInner from a JSON string"""
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
55
|
+
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
58
|
+
|
59
|
+
This has the following differences from calling pydantic's
|
60
|
+
`self.model_dump(by_alias=True)`:
|
61
|
+
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
63
|
+
were set at model initialization. Other fields with value `None`
|
64
|
+
are ignored.
|
65
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
66
|
+
"""
|
67
|
+
excluded_fields: Set[str] = set([
|
68
|
+
"additional_properties",
|
69
|
+
])
|
70
|
+
|
71
|
+
_dict = self.model_dump(
|
72
|
+
by_alias=True,
|
73
|
+
exclude=excluded_fields,
|
74
|
+
exclude_none=True,
|
75
|
+
)
|
76
|
+
# override the default output from pydantic by calling `to_dict()` of trip
|
77
|
+
if self.trip:
|
78
|
+
_dict['trip'] = self.trip.to_dict()
|
79
|
+
# puts key-value pairs in additional_properties in the top level
|
80
|
+
if self.additional_properties is not None:
|
81
|
+
for _key, _value in self.additional_properties.items():
|
82
|
+
_dict[_key] = _value
|
83
|
+
|
84
|
+
return _dict
|
85
|
+
|
86
|
+
@classmethod
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
88
|
+
"""Create an instance of RouteResponseAlternatesInner from a dict"""
|
89
|
+
if obj is None:
|
90
|
+
return None
|
91
|
+
|
92
|
+
if not isinstance(obj, dict):
|
93
|
+
return cls.model_validate(obj)
|
94
|
+
|
95
|
+
_obj = cls.model_validate({
|
96
|
+
"trip": RouteTrip.from_dict(obj["trip"]) if obj.get("trip") is not None else None
|
97
|
+
})
|
98
|
+
# store additional fields in additional_properties
|
99
|
+
for _key in obj.keys():
|
100
|
+
if _key not in cls.__properties:
|
101
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
102
|
+
|
103
|
+
return _obj
|
104
|
+
|
105
|
+
|
@@ -3,14 +3,14 @@
|
|
3
3
|
"""
|
4
4
|
Stadia Maps Geospatial APIs
|
5
5
|
|
6
|
-
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
6
|
+
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 6.1.0
|
9
9
|
Contact: support@stadiamaps.com
|
10
10
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
11
|
|
12
12
|
Do not edit the class manually.
|
13
|
-
"""
|
13
|
+
""" # noqa: E501
|
14
14
|
|
15
15
|
|
16
16
|
from __future__ import annotations
|
@@ -18,48 +18,65 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import Union
|
23
|
-
from
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
22
|
+
from typing import Any, ClassVar, Dict, List, Union
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
24
25
|
|
25
26
|
class RouteSummary(BaseModel):
|
26
27
|
"""
|
27
28
|
RouteSummary
|
28
|
-
"""
|
29
|
-
time: Union[StrictFloat, StrictInt] = Field(
|
30
|
-
length: Union[StrictFloat, StrictInt] = Field(
|
31
|
-
min_lat: Union[StrictFloat, StrictInt] = Field(
|
32
|
-
max_lat: Union[StrictFloat, StrictInt] = Field(
|
33
|
-
min_lon: Union[StrictFloat, StrictInt] = Field(
|
34
|
-
max_lon: Union[StrictFloat, StrictInt] = Field(
|
29
|
+
""" # noqa: E501
|
30
|
+
time: Union[StrictFloat, StrictInt] = Field(description="The estimated travel time, in seconds")
|
31
|
+
length: Union[StrictFloat, StrictInt] = Field(description="The estimated travel distance, in `units` (km or mi)")
|
32
|
+
min_lat: Union[StrictFloat, StrictInt] = Field(description="The minimum latitude of the bounding box containing the route.")
|
33
|
+
max_lat: Union[StrictFloat, StrictInt] = Field(description="The maximum latitude of the bounding box containing the route.")
|
34
|
+
min_lon: Union[StrictFloat, StrictInt] = Field(description="The minimum longitude of the bounding box containing the route.")
|
35
|
+
max_lon: Union[StrictFloat, StrictInt] = Field(description="The maximum longitude of the bounding box containing the route.")
|
35
36
|
additional_properties: Dict[str, Any] = {}
|
36
|
-
__properties = ["time", "length", "min_lat", "max_lat", "min_lon", "max_lon"]
|
37
|
+
__properties: ClassVar[List[str]] = ["time", "length", "min_lat", "max_lat", "min_lon", "max_lon"]
|
38
|
+
|
39
|
+
model_config = ConfigDict(
|
40
|
+
populate_by_name=True,
|
41
|
+
validate_assignment=True,
|
42
|
+
protected_namespaces=(),
|
43
|
+
)
|
37
44
|
|
38
|
-
class Config:
|
39
|
-
"""Pydantic configuration"""
|
40
|
-
allow_population_by_field_name = True
|
41
|
-
validate_assignment = True
|
42
45
|
|
43
46
|
def to_str(self) -> str:
|
44
47
|
"""Returns the string representation of the model using alias"""
|
45
|
-
return pprint.pformat(self.
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
46
49
|
|
47
50
|
def to_json(self) -> str:
|
48
51
|
"""Returns the JSON representation of the model using alias"""
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
49
53
|
return json.dumps(self.to_dict())
|
50
54
|
|
51
55
|
@classmethod
|
52
|
-
def from_json(cls, json_str: str) ->
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
53
57
|
"""Create an instance of RouteSummary from a JSON string"""
|
54
58
|
return cls.from_dict(json.loads(json_str))
|
55
59
|
|
56
|
-
def to_dict(self):
|
57
|
-
"""
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
62
|
+
|
63
|
+
This has the following differences from calling pydantic's
|
64
|
+
`self.model_dump(by_alias=True)`:
|
65
|
+
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
67
|
+
were set at model initialization. Other fields with value `None`
|
68
|
+
are ignored.
|
69
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
70
|
+
"""
|
71
|
+
excluded_fields: Set[str] = set([
|
72
|
+
"additional_properties",
|
73
|
+
])
|
74
|
+
|
75
|
+
_dict = self.model_dump(
|
76
|
+
by_alias=True,
|
77
|
+
exclude=excluded_fields,
|
78
|
+
exclude_none=True,
|
79
|
+
)
|
63
80
|
# puts key-value pairs in additional_properties in the top level
|
64
81
|
if self.additional_properties is not None:
|
65
82
|
for _key, _value in self.additional_properties.items():
|
@@ -68,15 +85,15 @@ class RouteSummary(BaseModel):
|
|
68
85
|
return _dict
|
69
86
|
|
70
87
|
@classmethod
|
71
|
-
def from_dict(cls, obj:
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
72
89
|
"""Create an instance of RouteSummary from a dict"""
|
73
90
|
if obj is None:
|
74
91
|
return None
|
75
92
|
|
76
93
|
if not isinstance(obj, dict):
|
77
|
-
return
|
94
|
+
return cls.model_validate(obj)
|
78
95
|
|
79
|
-
_obj =
|
96
|
+
_obj = cls.model_validate({
|
80
97
|
"time": obj.get("time"),
|
81
98
|
"length": obj.get("length"),
|
82
99
|
"min_lat": obj.get("min_lat"),
|
@@ -91,3 +108,4 @@ class RouteSummary(BaseModel):
|
|
91
108
|
|
92
109
|
return _obj
|
93
110
|
|
111
|
+
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Stadia Maps Geospatial APIs
|
5
|
+
|
6
|
+
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 6.1.0
|
9
|
+
Contact: support@stadiamaps.com
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
|
+
|
12
|
+
Do not edit the class manually.
|
13
|
+
""" # noqa: E501
|
14
|
+
|
15
|
+
|
16
|
+
from __future__ import annotations
|
17
|
+
import pprint
|
18
|
+
import re # noqa: F401
|
19
|
+
import json
|
20
|
+
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
23
|
+
from stadiamaps.models.route_leg import RouteLeg
|
24
|
+
from stadiamaps.models.route_summary import RouteSummary
|
25
|
+
from stadiamaps.models.routing_response_waypoint import RoutingResponseWaypoint
|
26
|
+
from stadiamaps.models.valhalla_languages import ValhallaLanguages
|
27
|
+
from stadiamaps.models.valhalla_long_units import ValhallaLongUnits
|
28
|
+
from typing import Optional, Set
|
29
|
+
from typing_extensions import Self
|
30
|
+
|
31
|
+
class RouteTrip(BaseModel):
|
32
|
+
"""
|
33
|
+
RouteTrip
|
34
|
+
""" # noqa: E501
|
35
|
+
status: StrictInt = Field(description="The response status code")
|
36
|
+
status_message: StrictStr = Field(description="The response status message")
|
37
|
+
units: ValhallaLongUnits
|
38
|
+
language: ValhallaLanguages
|
39
|
+
locations: List[RoutingResponseWaypoint]
|
40
|
+
legs: List[RouteLeg]
|
41
|
+
summary: RouteSummary
|
42
|
+
additional_properties: Dict[str, Any] = {}
|
43
|
+
__properties: ClassVar[List[str]] = ["status", "status_message", "units", "language", "locations", "legs", "summary"]
|
44
|
+
|
45
|
+
model_config = ConfigDict(
|
46
|
+
populate_by_name=True,
|
47
|
+
validate_assignment=True,
|
48
|
+
protected_namespaces=(),
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
def to_str(self) -> str:
|
53
|
+
"""Returns the string representation of the model using alias"""
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
55
|
+
|
56
|
+
def to_json(self) -> str:
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
58
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
59
|
+
return json.dumps(self.to_dict())
|
60
|
+
|
61
|
+
@classmethod
|
62
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
63
|
+
"""Create an instance of RouteTrip from a JSON string"""
|
64
|
+
return cls.from_dict(json.loads(json_str))
|
65
|
+
|
66
|
+
def to_dict(self) -> Dict[str, Any]:
|
67
|
+
"""Return the dictionary representation of the model using alias.
|
68
|
+
|
69
|
+
This has the following differences from calling pydantic's
|
70
|
+
`self.model_dump(by_alias=True)`:
|
71
|
+
|
72
|
+
* `None` is only added to the output dict for nullable fields that
|
73
|
+
were set at model initialization. Other fields with value `None`
|
74
|
+
are ignored.
|
75
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
76
|
+
"""
|
77
|
+
excluded_fields: Set[str] = set([
|
78
|
+
"additional_properties",
|
79
|
+
])
|
80
|
+
|
81
|
+
_dict = self.model_dump(
|
82
|
+
by_alias=True,
|
83
|
+
exclude=excluded_fields,
|
84
|
+
exclude_none=True,
|
85
|
+
)
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each item in locations (list)
|
87
|
+
_items = []
|
88
|
+
if self.locations:
|
89
|
+
for _item in self.locations:
|
90
|
+
if _item:
|
91
|
+
_items.append(_item.to_dict())
|
92
|
+
_dict['locations'] = _items
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of each item in legs (list)
|
94
|
+
_items = []
|
95
|
+
if self.legs:
|
96
|
+
for _item in self.legs:
|
97
|
+
if _item:
|
98
|
+
_items.append(_item.to_dict())
|
99
|
+
_dict['legs'] = _items
|
100
|
+
# override the default output from pydantic by calling `to_dict()` of summary
|
101
|
+
if self.summary:
|
102
|
+
_dict['summary'] = self.summary.to_dict()
|
103
|
+
# puts key-value pairs in additional_properties in the top level
|
104
|
+
if self.additional_properties is not None:
|
105
|
+
for _key, _value in self.additional_properties.items():
|
106
|
+
_dict[_key] = _value
|
107
|
+
|
108
|
+
return _dict
|
109
|
+
|
110
|
+
@classmethod
|
111
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
112
|
+
"""Create an instance of RouteTrip from a dict"""
|
113
|
+
if obj is None:
|
114
|
+
return None
|
115
|
+
|
116
|
+
if not isinstance(obj, dict):
|
117
|
+
return cls.model_validate(obj)
|
118
|
+
|
119
|
+
_obj = cls.model_validate({
|
120
|
+
"status": obj.get("status"),
|
121
|
+
"status_message": obj.get("status_message"),
|
122
|
+
"units": obj.get("units"),
|
123
|
+
"language": obj.get("language"),
|
124
|
+
"locations": [RoutingResponseWaypoint.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None,
|
125
|
+
"legs": [RouteLeg.from_dict(_item) for _item in obj["legs"]] if obj.get("legs") is not None else None,
|
126
|
+
"summary": RouteSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None
|
127
|
+
})
|
128
|
+
# store additional fields in additional_properties
|
129
|
+
for _key in obj.keys():
|
130
|
+
if _key not in cls.__properties:
|
131
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
132
|
+
|
133
|
+
return _obj
|
134
|
+
|
135
|
+
|
@@ -3,14 +3,14 @@
|
|
3
3
|
"""
|
4
4
|
Stadia Maps Geospatial APIs
|
5
5
|
|
6
|
-
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
6
|
+
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
|
7
7
|
|
8
|
-
The version of the OpenAPI document:
|
8
|
+
The version of the OpenAPI document: 6.1.0
|
9
9
|
Contact: support@stadiamaps.com
|
10
10
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
11
|
|
12
12
|
Do not edit the class manually.
|
13
|
-
"""
|
13
|
+
""" # noqa: E501
|
14
14
|
|
15
15
|
|
16
16
|
from __future__ import annotations
|
@@ -18,56 +18,74 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import Optional, Union
|
23
|
-
from
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
23
|
+
from typing_extensions import Annotated
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
24
26
|
|
25
27
|
class RoutingResponseWaypoint(BaseModel):
|
26
28
|
"""
|
27
29
|
RoutingResponseWaypoint
|
28
|
-
"""
|
29
|
-
lat: Union[
|
30
|
-
lon: Union[
|
31
|
-
type: Optional[StrictStr] = Field('break', description="A `break` represents the start or end of a leg, and allows reversals. A `through` location is an intermediate waypoint that must be visited between `break`s, but at which reversals are not allowed. A `via` is similar to a `through` except that reversals are allowed. A `break_through` is similar to a `break` in that it can be the start/end of a leg, but does not allow reversals.")
|
32
|
-
original_index: Optional[
|
30
|
+
""" # noqa: E501
|
31
|
+
lat: Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]] = Field(description="The latitude of a point in the shape.")
|
32
|
+
lon: Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]] = Field(description="The longitude of a point in the shape.")
|
33
|
+
type: Optional[StrictStr] = Field(default='break', description="A `break` represents the start or end of a leg, and allows reversals. A `through` location is an intermediate waypoint that must be visited between `break`s, but at which reversals are not allowed. A `via` is similar to a `through` except that reversals are allowed. A `break_through` is similar to a `break` in that it can be the start/end of a leg, but does not allow reversals.")
|
34
|
+
original_index: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The original index of the location (locations may be reordered for optimized routes)")
|
33
35
|
additional_properties: Dict[str, Any] = {}
|
34
|
-
__properties = ["lat", "lon", "type", "original_index"]
|
36
|
+
__properties: ClassVar[List[str]] = ["lat", "lon", "type", "original_index"]
|
35
37
|
|
36
|
-
@
|
38
|
+
@field_validator('type')
|
37
39
|
def type_validate_enum(cls, value):
|
38
40
|
"""Validates the enum"""
|
39
41
|
if value is None:
|
40
42
|
return value
|
41
43
|
|
42
|
-
if value not in ('break', 'through', 'via', 'break_through'):
|
44
|
+
if value not in set(['break', 'through', 'via', 'break_through']):
|
43
45
|
raise ValueError("must be one of enum values ('break', 'through', 'via', 'break_through')")
|
44
46
|
return value
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
model_config = ConfigDict(
|
49
|
+
populate_by_name=True,
|
50
|
+
validate_assignment=True,
|
51
|
+
protected_namespaces=(),
|
52
|
+
)
|
53
|
+
|
50
54
|
|
51
55
|
def to_str(self) -> str:
|
52
56
|
"""Returns the string representation of the model using alias"""
|
53
|
-
return pprint.pformat(self.
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
54
58
|
|
55
59
|
def to_json(self) -> str:
|
56
60
|
"""Returns the JSON representation of the model using alias"""
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
57
62
|
return json.dumps(self.to_dict())
|
58
63
|
|
59
64
|
@classmethod
|
60
|
-
def from_json(cls, json_str: str) ->
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
61
66
|
"""Create an instance of RoutingResponseWaypoint from a JSON string"""
|
62
67
|
return cls.from_dict(json.loads(json_str))
|
63
68
|
|
64
|
-
def to_dict(self):
|
65
|
-
"""
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
71
|
+
|
72
|
+
This has the following differences from calling pydantic's
|
73
|
+
`self.model_dump(by_alias=True)`:
|
74
|
+
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
76
|
+
were set at model initialization. Other fields with value `None`
|
77
|
+
are ignored.
|
78
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
79
|
+
"""
|
80
|
+
excluded_fields: Set[str] = set([
|
81
|
+
"additional_properties",
|
82
|
+
])
|
83
|
+
|
84
|
+
_dict = self.model_dump(
|
85
|
+
by_alias=True,
|
86
|
+
exclude=excluded_fields,
|
87
|
+
exclude_none=True,
|
88
|
+
)
|
71
89
|
# puts key-value pairs in additional_properties in the top level
|
72
90
|
if self.additional_properties is not None:
|
73
91
|
for _key, _value in self.additional_properties.items():
|
@@ -76,15 +94,15 @@ class RoutingResponseWaypoint(BaseModel):
|
|
76
94
|
return _dict
|
77
95
|
|
78
96
|
@classmethod
|
79
|
-
def from_dict(cls, obj:
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
80
98
|
"""Create an instance of RoutingResponseWaypoint from a dict"""
|
81
99
|
if obj is None:
|
82
100
|
return None
|
83
101
|
|
84
102
|
if not isinstance(obj, dict):
|
85
|
-
return
|
103
|
+
return cls.model_validate(obj)
|
86
104
|
|
87
|
-
_obj =
|
105
|
+
_obj = cls.model_validate({
|
88
106
|
"lat": obj.get("lat"),
|
89
107
|
"lon": obj.get("lon"),
|
90
108
|
"type": obj.get("type") if obj.get("type") is not None else 'break',
|
@@ -97,3 +115,4 @@ class RoutingResponseWaypoint(BaseModel):
|
|
97
115
|
|
98
116
|
return _obj
|
99
117
|
|
118
|
+
|