stadiamaps 1.0.6__py3-none-any.whl → 2.0.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 +69 -48
- stadiamaps/models/auto_costing_options_all_of.py +1 -1
- stadiamaps/models/base_costing_options.py +52 -33
- stadiamaps/models/base_trace_request.py +70 -40
- stadiamaps/models/bicycle_costing_options.py +61 -42
- stadiamaps/models/bicycle_costing_options_all_of.py +1 -1
- 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 +2 -2
- stadiamaps/models/geo_json_point.py +47 -28
- stadiamaps/models/geo_json_point_all_of.py +2 -2
- stadiamaps/models/geo_json_polygon.py +47 -28
- stadiamaps/models/geo_json_polygon_all_of.py +2 -2
- 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_node_all_of.py +1 -1
- 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_request_all_of.py +1 -1
- stadiamaps/models/map_match_route_response.py +57 -29
- stadiamaps/models/map_match_route_response_all_of.py +1 -1
- stadiamaps/models/map_match_trace_options.py +47 -29
- stadiamaps/models/map_match_waypoint.py +49 -30
- stadiamaps/models/map_match_waypoint_all_of.py +1 -1
- 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 +70 -49
- stadiamaps/models/motor_scooter_costing_options_all_of.py +1 -1
- stadiamaps/models/motorcycle_costing_options.py +69 -48
- stadiamaps/models/motorcycle_costing_options_all_of.py +1 -1
- 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_response_geocoding.py +1 -1
- 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_response_trip.py +1 -1
- 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_response_waypoint_all_of.py +1 -1
- stadiamaps/models/routing_waypoint.py +60 -41
- stadiamaps/models/routing_waypoint_all_of.py +1 -1
- stadiamaps/models/routing_waypoint_all_of_search_filter.py +48 -30
- stadiamaps/models/simple_routing_waypoint.py +48 -29
- stadiamaps/models/simple_routing_waypoint_all_of.py +1 -1
- 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.py +1 -1
- stadiamaps/models/trace_attributes_request_all_of_filters.py +2 -2
- stadiamaps/models/trace_attributes_response.py +54 -35
- stadiamaps/models/trace_attributes_response_all_of.py +1 -1
- 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 +72 -51
- stadiamaps/models/truck_costing_options_all_of.py +1 -1
- 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.6.dist-info → stadiamaps-2.0.0.dist-info}/METADATA +4 -4
- stadiamaps-2.0.0.dist-info/RECORD +128 -0
- {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/WHEEL +1 -1
- stadiamaps-1.0.6.dist-info/RECORD +0 -125
- {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/LICENSE.txt +0 -0
- {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/top_level.txt +0 -0
@@ -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.0.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,87 +18,104 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import Any, Dict, List, Optional, Union
|
23
|
-
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist, validator
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
24
23
|
from stadiamaps.models.maneuver_sign import ManeuverSign
|
25
24
|
from stadiamaps.models.travel_mode import TravelMode
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
26
27
|
|
27
28
|
class RouteManeuver(BaseModel):
|
28
29
|
"""
|
29
30
|
RouteManeuver
|
30
|
-
"""
|
31
|
-
type: StrictInt = Field(
|
32
|
-
instruction: StrictStr = Field(
|
33
|
-
verbal_transition_alert_instruction: Optional[StrictStr] = Field(None, description="Text suitable for use as a verbal navigation alert.")
|
34
|
-
verbal_pre_transition_instruction: Optional[StrictStr] = Field(None, description="Text suitable for use as a verbal navigation alert immediately prior to the maneuver transition.")
|
35
|
-
verbal_post_transition_instruction: Optional[StrictStr] = Field(None, description="Text suitable for use as a verbal navigation alert immediately after to the maneuver transition.")
|
36
|
-
street_names: Optional[
|
37
|
-
begin_street_names: Optional[
|
38
|
-
time: Union[StrictFloat, StrictInt] = Field(
|
39
|
-
length: Union[StrictFloat, StrictInt] = Field(
|
40
|
-
begin_shape_index: StrictInt = Field(
|
41
|
-
end_shape_index: StrictInt = Field(
|
42
|
-
toll: Optional[StrictBool] = Field(False, description="True any portion of the maneuver is subject to a toll.")
|
43
|
-
rough: Optional[StrictBool] = Field(False, description="True any portion of the maneuver is unpaved or has portions of rough pavement.")
|
44
|
-
gate: Optional[StrictBool] = Field(False, description="True if a gate is encountered in the course of this maneuver.")
|
45
|
-
ferry: Optional[StrictBool] = Field(False, description="True if a ferry is encountered in the course of this maneuver.")
|
31
|
+
""" # noqa: E501
|
32
|
+
type: StrictInt = Field(description="The type of route maneuver. | Code | Type | |------|-------------------------------------| | 0 | None | | 1 | Start | | 2 | Start right | | 3 | Start left | | 4 | Destination | | 5 | Destination right | | 6 | Destination left | | 7 | Becomes | | 8 | Continue | | 9 | Slight right | | 10 | Right | | 11 | Sharp right | | 12 | U-turn right | | 13 | U-turn left | | 14 | Sharp left | | 15 | Left | | 16 | Slight left | | 17 | Ramp straight | | 18 | Ramp right | | 19 | Ramp left | | 20 | Exit right | | 21 | Exit left | | 22 | Stay straight | | 23 | Stay right | | 24 | Stay left | | 25 | Merge | | 26 | Enter roundabout | | 27 | Exit roundabout | | 28 | Enter ferry | | 29 | Exit ferry | | 30 | Transit | | 31 | Transit transfer | | 32 | Transit remain on | | 33 | Transit connection start | | 34 | Transit connection transfer | | 35 | Transit connection destination | | 36 | Post-transit connection destination | | 37 | Merge right | | 38 | Merge left | ")
|
33
|
+
instruction: StrictStr = Field(description="The written maneuver instruction.")
|
34
|
+
verbal_transition_alert_instruction: Optional[StrictStr] = Field(default=None, description="Text suitable for use as a verbal navigation alert.")
|
35
|
+
verbal_pre_transition_instruction: Optional[StrictStr] = Field(default=None, description="Text suitable for use as a verbal navigation alert immediately prior to the maneuver transition.")
|
36
|
+
verbal_post_transition_instruction: Optional[StrictStr] = Field(default=None, description="Text suitable for use as a verbal navigation alert immediately after to the maneuver transition.")
|
37
|
+
street_names: Optional[List[StrictStr]] = Field(default=None, description="A list of street names that are consistent along the entire maneuver.")
|
38
|
+
begin_street_names: Optional[List[StrictStr]] = Field(default=None, description="A list of street names at the beginning of the maneuver, if they are different from the names at the end.")
|
39
|
+
time: Union[StrictFloat, StrictInt] = Field(description="The estimated time to complete the entire maneuver, in seconds.")
|
40
|
+
length: Union[StrictFloat, StrictInt] = Field(description="The length of the maneuver, in `units`.")
|
41
|
+
begin_shape_index: StrictInt = Field(description="The index into the list of shape points for the start of the maneuver.")
|
42
|
+
end_shape_index: StrictInt = Field(description="The index into the list of shape points for the end of the maneuver.")
|
43
|
+
toll: Optional[StrictBool] = Field(default=False, description="True any portion of the maneuver is subject to a toll.")
|
44
|
+
rough: Optional[StrictBool] = Field(default=False, description="True any portion of the maneuver is unpaved or has portions of rough pavement.")
|
45
|
+
gate: Optional[StrictBool] = Field(default=False, description="True if a gate is encountered in the course of this maneuver.")
|
46
|
+
ferry: Optional[StrictBool] = Field(default=False, description="True if a ferry is encountered in the course of this maneuver.")
|
46
47
|
sign: Optional[ManeuverSign] = None
|
47
|
-
roundabout_exit_count: Optional[StrictInt] = Field(None, description="The exit number of the roundabout to take after entering.")
|
48
|
-
depart_instruction: Optional[StrictInt] = Field(None, description="The written departure time instruction (typically used in a transit maneuver).")
|
49
|
-
verbal_depart_instruction: Optional[StrictInt] = Field(None, description="Text suitable for use as a verbal departure time instruction (typically used in a transit maneuver).")
|
50
|
-
arrive_instruction: Optional[StrictInt] = Field(None, description="The written arrival time instruction (typically used in a transit maneuver).")
|
51
|
-
verbal_arrive_instruction: Optional[StrictInt] = Field(None, description="Text suitable for use as a verbal departure time instruction (typically used in a transit maneuver).")
|
52
|
-
transit_info: Optional[Dict[str, Any]] = Field(None, description="Public transit info (not currently supported).")
|
53
|
-
verbal_multi_cue: Optional[StrictBool] = Field(False, description="True if the `verbal_pre_transition_instruction` has been appended with the verbal instruction of the next maneuver.")
|
54
|
-
travel_mode: TravelMode
|
55
|
-
travel_type: StrictStr = Field(
|
56
|
-
bss_maneuver_type: Optional[StrictStr] = Field(None, description="Describes a bike share action when using bikeshare routing.")
|
48
|
+
roundabout_exit_count: Optional[StrictInt] = Field(default=None, description="The exit number of the roundabout to take after entering.")
|
49
|
+
depart_instruction: Optional[StrictInt] = Field(default=None, description="The written departure time instruction (typically used in a transit maneuver).")
|
50
|
+
verbal_depart_instruction: Optional[StrictInt] = Field(default=None, description="Text suitable for use as a verbal departure time instruction (typically used in a transit maneuver).")
|
51
|
+
arrive_instruction: Optional[StrictInt] = Field(default=None, description="The written arrival time instruction (typically used in a transit maneuver).")
|
52
|
+
verbal_arrive_instruction: Optional[StrictInt] = Field(default=None, description="Text suitable for use as a verbal departure time instruction (typically used in a transit maneuver).")
|
53
|
+
transit_info: Optional[Dict[str, Any]] = Field(default=None, description="Public transit info (not currently supported).")
|
54
|
+
verbal_multi_cue: Optional[StrictBool] = Field(default=False, description="True if the `verbal_pre_transition_instruction` has been appended with the verbal instruction of the next maneuver.")
|
55
|
+
travel_mode: TravelMode
|
56
|
+
travel_type: StrictStr = Field(description="The type of travel over the maneuver. This can be thought of as a specialization of the travel mode. For example, vehicular travel may be via car, motorcycle, etc.; and travel via bicycle may be via a road bike, mountain bike, etc.")
|
57
|
+
bss_maneuver_type: Optional[StrictStr] = Field(default=None, description="Describes a bike share action when using bikeshare routing.")
|
57
58
|
additional_properties: Dict[str, Any] = {}
|
58
|
-
__properties = ["type", "instruction", "verbal_transition_alert_instruction", "verbal_pre_transition_instruction", "verbal_post_transition_instruction", "street_names", "begin_street_names", "time", "length", "begin_shape_index", "end_shape_index", "toll", "rough", "gate", "ferry", "sign", "roundabout_exit_count", "depart_instruction", "verbal_depart_instruction", "arrive_instruction", "verbal_arrive_instruction", "transit_info", "verbal_multi_cue", "travel_mode", "travel_type", "bss_maneuver_type"]
|
59
|
+
__properties: ClassVar[List[str]] = ["type", "instruction", "verbal_transition_alert_instruction", "verbal_pre_transition_instruction", "verbal_post_transition_instruction", "street_names", "begin_street_names", "time", "length", "begin_shape_index", "end_shape_index", "toll", "rough", "gate", "ferry", "sign", "roundabout_exit_count", "depart_instruction", "verbal_depart_instruction", "arrive_instruction", "verbal_arrive_instruction", "transit_info", "verbal_multi_cue", "travel_mode", "travel_type", "bss_maneuver_type"]
|
59
60
|
|
60
|
-
@
|
61
|
+
@field_validator('travel_type')
|
61
62
|
def travel_type_validate_enum(cls, value):
|
62
63
|
"""Validates the enum"""
|
63
|
-
if value not in ('car', 'foot', 'road', '
|
64
|
-
raise ValueError("must be one of enum values ('car', 'foot', 'road', '
|
64
|
+
if value not in set(['car', 'motorcycle', 'bus', 'tractor_trailer', 'motor_scooter', 'foot', 'wheelchair', 'segway', 'road', 'cross', 'hybrid', 'mountain', 'tram', 'metro', 'rail', 'ferry', 'cable_car', 'gondola', 'funicular', 'golf_cart', 'low_speed_vehicle']):
|
65
|
+
raise ValueError("must be one of enum values ('car', 'motorcycle', 'bus', 'tractor_trailer', 'motor_scooter', 'foot', 'wheelchair', 'segway', 'road', 'cross', 'hybrid', 'mountain', 'tram', 'metro', 'rail', 'ferry', 'cable_car', 'gondola', 'funicular', 'golf_cart', 'low_speed_vehicle')")
|
65
66
|
return value
|
66
67
|
|
67
|
-
@
|
68
|
+
@field_validator('bss_maneuver_type')
|
68
69
|
def bss_maneuver_type_validate_enum(cls, value):
|
69
70
|
"""Validates the enum"""
|
70
71
|
if value is None:
|
71
72
|
return value
|
72
73
|
|
73
|
-
if value not in ('NoneAction', 'RentBikeAtBikeShare', 'ReturnBikeAtBikeShare'):
|
74
|
+
if value not in set(['NoneAction', 'RentBikeAtBikeShare', 'ReturnBikeAtBikeShare']):
|
74
75
|
raise ValueError("must be one of enum values ('NoneAction', 'RentBikeAtBikeShare', 'ReturnBikeAtBikeShare')")
|
75
76
|
return value
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
model_config = ConfigDict(
|
79
|
+
populate_by_name=True,
|
80
|
+
validate_assignment=True,
|
81
|
+
protected_namespaces=(),
|
82
|
+
)
|
83
|
+
|
81
84
|
|
82
85
|
def to_str(self) -> str:
|
83
86
|
"""Returns the string representation of the model using alias"""
|
84
|
-
return pprint.pformat(self.
|
87
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
85
88
|
|
86
89
|
def to_json(self) -> str:
|
87
90
|
"""Returns the JSON representation of the model using alias"""
|
91
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
88
92
|
return json.dumps(self.to_dict())
|
89
93
|
|
90
94
|
@classmethod
|
91
|
-
def from_json(cls, json_str: str) ->
|
95
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
92
96
|
"""Create an instance of RouteManeuver from a JSON string"""
|
93
97
|
return cls.from_dict(json.loads(json_str))
|
94
98
|
|
95
|
-
def to_dict(self):
|
96
|
-
"""
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
def to_dict(self) -> Dict[str, Any]:
|
100
|
+
"""Return the dictionary representation of the model using alias.
|
101
|
+
|
102
|
+
This has the following differences from calling pydantic's
|
103
|
+
`self.model_dump(by_alias=True)`:
|
104
|
+
|
105
|
+
* `None` is only added to the output dict for nullable fields that
|
106
|
+
were set at model initialization. Other fields with value `None`
|
107
|
+
are ignored.
|
108
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
109
|
+
"""
|
110
|
+
excluded_fields: Set[str] = set([
|
111
|
+
"additional_properties",
|
112
|
+
])
|
113
|
+
|
114
|
+
_dict = self.model_dump(
|
115
|
+
by_alias=True,
|
116
|
+
exclude=excluded_fields,
|
117
|
+
exclude_none=True,
|
118
|
+
)
|
102
119
|
# override the default output from pydantic by calling `to_dict()` of sign
|
103
120
|
if self.sign:
|
104
121
|
_dict['sign'] = self.sign.to_dict()
|
@@ -110,15 +127,15 @@ class RouteManeuver(BaseModel):
|
|
110
127
|
return _dict
|
111
128
|
|
112
129
|
@classmethod
|
113
|
-
def from_dict(cls, obj:
|
130
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
114
131
|
"""Create an instance of RouteManeuver from a dict"""
|
115
132
|
if obj is None:
|
116
133
|
return None
|
117
134
|
|
118
135
|
if not isinstance(obj, dict):
|
119
|
-
return
|
136
|
+
return cls.model_validate(obj)
|
120
137
|
|
121
|
-
_obj =
|
138
|
+
_obj = cls.model_validate({
|
122
139
|
"type": obj.get("type"),
|
123
140
|
"instruction": obj.get("instruction"),
|
124
141
|
"verbal_transition_alert_instruction": obj.get("verbal_transition_alert_instruction"),
|
@@ -134,7 +151,7 @@ class RouteManeuver(BaseModel):
|
|
134
151
|
"rough": obj.get("rough") if obj.get("rough") is not None else False,
|
135
152
|
"gate": obj.get("gate") if obj.get("gate") is not None else False,
|
136
153
|
"ferry": obj.get("ferry") if obj.get("ferry") is not None else False,
|
137
|
-
"sign": ManeuverSign.from_dict(obj
|
154
|
+
"sign": ManeuverSign.from_dict(obj["sign"]) if obj.get("sign") is not None else None,
|
138
155
|
"roundabout_exit_count": obj.get("roundabout_exit_count"),
|
139
156
|
"depart_instruction": obj.get("depart_instruction"),
|
140
157
|
"verbal_depart_instruction": obj.get("verbal_depart_instruction"),
|
@@ -153,3 +170,4 @@ class RouteManeuver(BaseModel):
|
|
153
170
|
|
154
171
|
return _obj
|
155
172
|
|
173
|
+
|
@@ -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.0.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,53 +18,85 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import List, Optional, Union
|
23
|
-
from
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
23
|
+
from typing_extensions import Annotated
|
24
24
|
from stadiamaps.models.costing_model import CostingModel
|
25
25
|
from stadiamaps.models.costing_options import CostingOptions
|
26
|
-
from stadiamaps.models.
|
26
|
+
from stadiamaps.models.distance_unit import DistanceUnit
|
27
27
|
from stadiamaps.models.routing_waypoint import RoutingWaypoint
|
28
|
+
from stadiamaps.models.valhalla_languages import ValhallaLanguages
|
29
|
+
from typing import Optional, Set
|
30
|
+
from typing_extensions import Self
|
28
31
|
|
29
32
|
class RouteRequest(BaseModel):
|
30
33
|
"""
|
31
34
|
RouteRequest
|
32
|
-
"""
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
""" # noqa: E501
|
36
|
+
units: Optional[DistanceUnit] = None
|
37
|
+
language: Optional[ValhallaLanguages] = None
|
38
|
+
directions_type: Optional[StrictStr] = Field(default='instructions', description="The level of directional narrative to include. Locations and times will always be returned, but narrative generation verbosity can be controlled with this parameter.")
|
39
|
+
id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
|
40
|
+
locations: Annotated[List[RoutingWaypoint], Field(min_length=2)]
|
41
|
+
costing: CostingModel
|
36
42
|
costing_options: Optional[CostingOptions] = None
|
37
|
-
|
38
|
-
|
39
|
-
|
43
|
+
exclude_locations: Optional[List[RoutingWaypoint]] = Field(default=None, description="This has the same format as the locations list. Locations are mapped to the closed road(s), and these road(s) are excluded from the route path computation.")
|
44
|
+
exclude_polygons: Optional[List[List[List[Union[StrictFloat, StrictInt]]]]] = Field(default=None, description="One or multiple exterior rings of polygons in the form of nested JSON arrays. Roads intersecting these rings will be avoided during path finding. Open rings will be closed automatically. If you only need to avoid a few specific roads, it's much more efficient to use `exclude_locations`.")
|
45
|
+
alternates: Optional[StrictInt] = Field(default=None, description="How many alternate routes are desired. Note that fewer or no alternates may be returned. Alternates are not yet supported on routes with more than 2 locations or on time-dependent routes.")
|
40
46
|
additional_properties: Dict[str, Any] = {}
|
41
|
-
__properties = ["id", "locations", "costing", "costing_options", "
|
47
|
+
__properties: ClassVar[List[str]] = ["units", "language", "directions_type", "id", "locations", "costing", "costing_options", "exclude_locations", "exclude_polygons", "alternates"]
|
48
|
+
|
49
|
+
@field_validator('directions_type')
|
50
|
+
def directions_type_validate_enum(cls, value):
|
51
|
+
"""Validates the enum"""
|
52
|
+
if value is None:
|
53
|
+
return value
|
54
|
+
|
55
|
+
if value not in set(['none', 'maneuvers', 'instructions']):
|
56
|
+
raise ValueError("must be one of enum values ('none', 'maneuvers', 'instructions')")
|
57
|
+
return value
|
58
|
+
|
59
|
+
model_config = ConfigDict(
|
60
|
+
populate_by_name=True,
|
61
|
+
validate_assignment=True,
|
62
|
+
protected_namespaces=(),
|
63
|
+
)
|
42
64
|
|
43
|
-
class Config:
|
44
|
-
"""Pydantic configuration"""
|
45
|
-
allow_population_by_field_name = True
|
46
|
-
validate_assignment = True
|
47
65
|
|
48
66
|
def to_str(self) -> str:
|
49
67
|
"""Returns the string representation of the model using alias"""
|
50
|
-
return pprint.pformat(self.
|
68
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
51
69
|
|
52
70
|
def to_json(self) -> str:
|
53
71
|
"""Returns the JSON representation of the model using alias"""
|
72
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
54
73
|
return json.dumps(self.to_dict())
|
55
74
|
|
56
75
|
@classmethod
|
57
|
-
def from_json(cls, json_str: str) ->
|
76
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
58
77
|
"""Create an instance of RouteRequest from a JSON string"""
|
59
78
|
return cls.from_dict(json.loads(json_str))
|
60
79
|
|
61
|
-
def to_dict(self):
|
62
|
-
"""
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
80
|
+
def to_dict(self) -> Dict[str, Any]:
|
81
|
+
"""Return the dictionary representation of the model using alias.
|
82
|
+
|
83
|
+
This has the following differences from calling pydantic's
|
84
|
+
`self.model_dump(by_alias=True)`:
|
85
|
+
|
86
|
+
* `None` is only added to the output dict for nullable fields that
|
87
|
+
were set at model initialization. Other fields with value `None`
|
88
|
+
are ignored.
|
89
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
90
|
+
"""
|
91
|
+
excluded_fields: Set[str] = set([
|
92
|
+
"additional_properties",
|
93
|
+
])
|
94
|
+
|
95
|
+
_dict = self.model_dump(
|
96
|
+
by_alias=True,
|
97
|
+
exclude=excluded_fields,
|
98
|
+
exclude_none=True,
|
99
|
+
)
|
68
100
|
# override the default output from pydantic by calling `to_dict()` of each item in locations (list)
|
69
101
|
_items = []
|
70
102
|
if self.locations:
|
@@ -75,16 +107,13 @@ class RouteRequest(BaseModel):
|
|
75
107
|
# override the default output from pydantic by calling `to_dict()` of costing_options
|
76
108
|
if self.costing_options:
|
77
109
|
_dict['costing_options'] = self.costing_options.to_dict()
|
78
|
-
# override the default output from pydantic by calling `to_dict()` of each item in
|
110
|
+
# override the default output from pydantic by calling `to_dict()` of each item in exclude_locations (list)
|
79
111
|
_items = []
|
80
|
-
if self.
|
81
|
-
for _item in self.
|
112
|
+
if self.exclude_locations:
|
113
|
+
for _item in self.exclude_locations:
|
82
114
|
if _item:
|
83
115
|
_items.append(_item.to_dict())
|
84
|
-
_dict['
|
85
|
-
# override the default output from pydantic by calling `to_dict()` of directions_options
|
86
|
-
if self.directions_options:
|
87
|
-
_dict['directions_options'] = self.directions_options.to_dict()
|
116
|
+
_dict['exclude_locations'] = _items
|
88
117
|
# puts key-value pairs in additional_properties in the top level
|
89
118
|
if self.additional_properties is not None:
|
90
119
|
for _key, _value in self.additional_properties.items():
|
@@ -93,22 +122,25 @@ class RouteRequest(BaseModel):
|
|
93
122
|
return _dict
|
94
123
|
|
95
124
|
@classmethod
|
96
|
-
def from_dict(cls, obj:
|
125
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
97
126
|
"""Create an instance of RouteRequest from a dict"""
|
98
127
|
if obj is None:
|
99
128
|
return None
|
100
129
|
|
101
130
|
if not isinstance(obj, dict):
|
102
|
-
return
|
131
|
+
return cls.model_validate(obj)
|
103
132
|
|
104
|
-
_obj =
|
133
|
+
_obj = cls.model_validate({
|
134
|
+
"units": obj.get("units"),
|
135
|
+
"language": obj.get("language"),
|
136
|
+
"directions_type": obj.get("directions_type") if obj.get("directions_type") is not None else 'instructions',
|
105
137
|
"id": obj.get("id"),
|
106
|
-
"locations": [RoutingWaypoint.from_dict(_item) for _item in obj
|
138
|
+
"locations": [RoutingWaypoint.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None,
|
107
139
|
"costing": obj.get("costing"),
|
108
|
-
"costing_options": CostingOptions.from_dict(obj
|
109
|
-
"
|
110
|
-
"
|
111
|
-
"
|
140
|
+
"costing_options": CostingOptions.from_dict(obj["costing_options"]) if obj.get("costing_options") is not None else None,
|
141
|
+
"exclude_locations": [RoutingWaypoint.from_dict(_item) for _item in obj["exclude_locations"]] if obj.get("exclude_locations") is not None else None,
|
142
|
+
"exclude_polygons": obj.get("exclude_polygons"),
|
143
|
+
"alternates": obj.get("alternates")
|
112
144
|
})
|
113
145
|
# store additional fields in additional_properties
|
114
146
|
for _key in obj.keys():
|
@@ -117,3 +149,4 @@ class RouteRequest(BaseModel):
|
|
117
149
|
|
118
150
|
return _obj
|
119
151
|
|
152
|
+
|
@@ -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.0.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,74 @@ import pprint
|
|
18
18
|
import re # noqa: F401
|
19
19
|
import json
|
20
20
|
|
21
|
-
|
22
|
-
from typing import Optional
|
23
|
-
from
|
24
|
-
from stadiamaps.models.
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from stadiamaps.models.route_response_alternates_inner import RouteResponseAlternatesInner
|
24
|
+
from stadiamaps.models.route_trip import RouteTrip
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
25
27
|
|
26
28
|
class RouteResponse(BaseModel):
|
27
29
|
"""
|
28
30
|
RouteResponse
|
29
|
-
"""
|
30
|
-
id: Optional[StrictStr] = Field(None, description="An identifier to disambiguate requests (echoed by the server).")
|
31
|
-
trip:
|
31
|
+
""" # noqa: E501
|
32
|
+
id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
|
33
|
+
trip: RouteTrip
|
34
|
+
alternates: Optional[List[RouteResponseAlternatesInner]] = None
|
32
35
|
additional_properties: Dict[str, Any] = {}
|
33
|
-
__properties = ["id", "trip"]
|
36
|
+
__properties: ClassVar[List[str]] = ["id", "trip", "alternates"]
|
37
|
+
|
38
|
+
model_config = ConfigDict(
|
39
|
+
populate_by_name=True,
|
40
|
+
validate_assignment=True,
|
41
|
+
protected_namespaces=(),
|
42
|
+
)
|
34
43
|
|
35
|
-
class Config:
|
36
|
-
"""Pydantic configuration"""
|
37
|
-
allow_population_by_field_name = True
|
38
|
-
validate_assignment = True
|
39
44
|
|
40
45
|
def to_str(self) -> str:
|
41
46
|
"""Returns the string representation of the model using alias"""
|
42
|
-
return pprint.pformat(self.
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
43
48
|
|
44
49
|
def to_json(self) -> str:
|
45
50
|
"""Returns the JSON representation of the model using alias"""
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
46
52
|
return json.dumps(self.to_dict())
|
47
53
|
|
48
54
|
@classmethod
|
49
|
-
def from_json(cls, json_str: str) ->
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
50
56
|
"""Create an instance of RouteResponse from a JSON string"""
|
51
57
|
return cls.from_dict(json.loads(json_str))
|
52
58
|
|
53
|
-
def to_dict(self):
|
54
|
-
"""
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
61
|
+
|
62
|
+
This has the following differences from calling pydantic's
|
63
|
+
`self.model_dump(by_alias=True)`:
|
64
|
+
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
66
|
+
were set at model initialization. Other fields with value `None`
|
67
|
+
are ignored.
|
68
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
69
|
+
"""
|
70
|
+
excluded_fields: Set[str] = set([
|
71
|
+
"additional_properties",
|
72
|
+
])
|
73
|
+
|
74
|
+
_dict = self.model_dump(
|
75
|
+
by_alias=True,
|
76
|
+
exclude=excluded_fields,
|
77
|
+
exclude_none=True,
|
78
|
+
)
|
60
79
|
# override the default output from pydantic by calling `to_dict()` of trip
|
61
80
|
if self.trip:
|
62
81
|
_dict['trip'] = self.trip.to_dict()
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of each item in alternates (list)
|
83
|
+
_items = []
|
84
|
+
if self.alternates:
|
85
|
+
for _item in self.alternates:
|
86
|
+
if _item:
|
87
|
+
_items.append(_item.to_dict())
|
88
|
+
_dict['alternates'] = _items
|
63
89
|
# puts key-value pairs in additional_properties in the top level
|
64
90
|
if self.additional_properties is not None:
|
65
91
|
for _key, _value in self.additional_properties.items():
|
@@ -68,17 +94,18 @@ class RouteResponse(BaseModel):
|
|
68
94
|
return _dict
|
69
95
|
|
70
96
|
@classmethod
|
71
|
-
def from_dict(cls, obj:
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
72
98
|
"""Create an instance of RouteResponse from a dict"""
|
73
99
|
if obj is None:
|
74
100
|
return None
|
75
101
|
|
76
102
|
if not isinstance(obj, dict):
|
77
|
-
return
|
103
|
+
return cls.model_validate(obj)
|
78
104
|
|
79
|
-
_obj =
|
105
|
+
_obj = cls.model_validate({
|
80
106
|
"id": obj.get("id"),
|
81
|
-
"trip":
|
107
|
+
"trip": RouteTrip.from_dict(obj["trip"]) if obj.get("trip") is not None else None,
|
108
|
+
"alternates": [RouteResponseAlternatesInner.from_dict(_item) for _item in obj["alternates"]] if obj.get("alternates") is not None else None
|
82
109
|
})
|
83
110
|
# store additional fields in additional_properties
|
84
111
|
for _key in obj.keys():
|
@@ -87,3 +114,4 @@ class RouteResponse(BaseModel):
|
|
87
114
|
|
88
115
|
return _obj
|
89
116
|
|
117
|
+
|