stadiamaps 3.2.1__py3-none-any.whl → 4.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.
Files changed (134) hide show
  1. stadiamaps/__init__.py +23 -2
  2. stadiamaps/api/geocoding_api.py +1 -1
  3. stadiamaps/api/geospatial_api.py +1 -1
  4. stadiamaps/api/routing_api.py +12 -12
  5. stadiamaps/api_client.py +9 -2
  6. stadiamaps/configuration.py +3 -3
  7. stadiamaps/exceptions.py +1 -1
  8. stadiamaps/models/__init__.py +22 -1
  9. stadiamaps/models/access.py +1 -1
  10. stadiamaps/models/admin_region.py +1 -1
  11. stadiamaps/models/administrative.py +1 -1
  12. stadiamaps/models/annotation_filters.py +124 -0
  13. stadiamaps/models/auto_costing_options.py +1 -1
  14. stadiamaps/models/base_costing_options.py +1 -1
  15. stadiamaps/models/base_trace_request.py +4 -4
  16. stadiamaps/models/bicycle_costing_options.py +1 -1
  17. stadiamaps/models/bike_network.py +1 -1
  18. stadiamaps/models/bulk_request.py +1 -1
  19. stadiamaps/models/bulk_request_query.py +1 -1
  20. stadiamaps/models/bulk_search_response.py +1 -1
  21. stadiamaps/models/contour.py +1 -1
  22. stadiamaps/models/coordinate.py +1 -1
  23. stadiamaps/models/costing_model.py +1 -1
  24. stadiamaps/models/costing_options.py +1 -1
  25. stadiamaps/models/directions_options.py +1 -1
  26. stadiamaps/models/distance_unit.py +1 -1
  27. stadiamaps/models/edge_sign.py +1 -1
  28. stadiamaps/models/edge_use.py +1 -1
  29. stadiamaps/models/end_node.py +4 -4
  30. stadiamaps/models/extended_directions_options.py +121 -0
  31. stadiamaps/models/geo_attributes.py +1 -1
  32. stadiamaps/models/geo_json_geometry.py +1 -1
  33. stadiamaps/models/geo_json_geometry_base.py +1 -1
  34. stadiamaps/models/geo_json_line_string.py +1 -1
  35. stadiamaps/models/geo_json_point.py +1 -1
  36. stadiamaps/models/geo_json_polygon.py +1 -1
  37. stadiamaps/models/geocoding_object.py +1 -1
  38. stadiamaps/models/height_request.py +4 -4
  39. stadiamaps/models/height_response.py +4 -4
  40. stadiamaps/models/highway_classification.py +1 -1
  41. stadiamaps/models/intersecting_edge.py +1 -1
  42. stadiamaps/models/isochrone_costing_model.py +1 -1
  43. stadiamaps/models/isochrone_feature.py +1 -1
  44. stadiamaps/models/isochrone_properties.py +1 -1
  45. stadiamaps/models/isochrone_request.py +7 -7
  46. stadiamaps/models/isochrone_response.py +4 -4
  47. stadiamaps/models/locate_detailed_edge.py +1 -1
  48. stadiamaps/models/locate_edge.py +1 -1
  49. stadiamaps/models/locate_edge_info.py +1 -1
  50. stadiamaps/models/locate_node.py +1 -1
  51. stadiamaps/models/locate_object.py +7 -7
  52. stadiamaps/models/low_speed_vehicle_costing_options.py +1 -1
  53. stadiamaps/models/maneuver_sign.py +13 -13
  54. stadiamaps/models/maneuver_sign_element.py +1 -1
  55. stadiamaps/models/map_match_costing_model.py +1 -1
  56. stadiamaps/models/map_match_request.py +27 -5
  57. stadiamaps/models/map_match_route_response.py +4 -4
  58. stadiamaps/models/map_match_trace_options.py +1 -1
  59. stadiamaps/models/map_match_waypoint.py +1 -1
  60. stadiamaps/models/matched_point.py +1 -1
  61. stadiamaps/models/matrix_costing_model.py +1 -1
  62. stadiamaps/models/matrix_distance.py +1 -1
  63. stadiamaps/models/matrix_request.py +7 -7
  64. stadiamaps/models/matrix_response.py +13 -13
  65. stadiamaps/models/matrix_waypoint.py +1 -1
  66. stadiamaps/models/motor_scooter_costing_options.py +1 -1
  67. stadiamaps/models/motorcycle_costing_options.py +1 -1
  68. stadiamaps/models/nearest_roads_request.py +4 -4
  69. stadiamaps/models/node_id.py +1 -1
  70. stadiamaps/models/node_type.py +1 -1
  71. stadiamaps/models/optimized_route_request.py +28 -6
  72. stadiamaps/models/osrm_admin.py +103 -0
  73. stadiamaps/models/osrm_annotation.py +117 -0
  74. stadiamaps/models/osrm_banner_component.py +113 -0
  75. stadiamaps/models/osrm_banner_content.py +131 -0
  76. stadiamaps/models/osrm_banner_instruction.py +112 -0
  77. stadiamaps/models/osrm_base_api_response.py +112 -0
  78. stadiamaps/models/osrm_guidance_modifier.py +44 -0
  79. stadiamaps/models/osrm_intersection.py +145 -0
  80. stadiamaps/models/osrm_lane.py +111 -0
  81. stadiamaps/models/osrm_route.py +119 -0
  82. stadiamaps/models/osrm_route_leg.py +148 -0
  83. stadiamaps/models/osrm_route_response.py +132 -0
  84. stadiamaps/models/osrm_route_step.py +185 -0
  85. stadiamaps/models/osrm_speed_limit.py +117 -0
  86. stadiamaps/models/osrm_step_maneuver.py +127 -0
  87. stadiamaps/models/osrm_via_waypoint.py +105 -0
  88. stadiamaps/models/osrm_voice_instruction.py +105 -0
  89. stadiamaps/models/osrm_waypoint.py +108 -0
  90. stadiamaps/models/pedestrian_costing_options.py +1 -1
  91. stadiamaps/models/pelias_geo_json_feature.py +1 -1
  92. stadiamaps/models/pelias_geo_json_properties.py +1 -1
  93. stadiamaps/models/pelias_geo_json_properties_addendum.py +1 -1
  94. stadiamaps/models/pelias_geo_json_properties_addendum_osm.py +1 -1
  95. stadiamaps/models/pelias_layer.py +1 -1
  96. stadiamaps/models/pelias_response.py +4 -4
  97. stadiamaps/models/pelias_source.py +1 -1
  98. stadiamaps/models/restrictions.py +1 -1
  99. stadiamaps/models/road_class.py +1 -1
  100. stadiamaps/models/route200_response.py +138 -0
  101. stadiamaps/models/route_leg.py +4 -4
  102. stadiamaps/models/route_maneuver.py +1 -1
  103. stadiamaps/models/route_request.py +30 -8
  104. stadiamaps/models/route_response.py +4 -4
  105. stadiamaps/models/route_response_alternates_inner.py +1 -1
  106. stadiamaps/models/route_summary.py +1 -1
  107. stadiamaps/models/route_trip.py +7 -7
  108. stadiamaps/models/routing_response_waypoint.py +1 -1
  109. stadiamaps/models/routing_waypoint.py +1 -1
  110. stadiamaps/models/routing_waypoint_all_of_search_filter.py +1 -1
  111. stadiamaps/models/search_query.py +1 -1
  112. stadiamaps/models/search_structured_query.py +1 -1
  113. stadiamaps/models/simple_routing_waypoint.py +1 -1
  114. stadiamaps/models/speeds.py +1 -1
  115. stadiamaps/models/trace_attribute_filter_options.py +1 -1
  116. stadiamaps/models/trace_attribute_key.py +1 -1
  117. stadiamaps/models/trace_attributes_base_response.py +10 -10
  118. stadiamaps/models/trace_attributes_request.py +4 -4
  119. stadiamaps/models/trace_attributes_response.py +13 -13
  120. stadiamaps/models/trace_edge.py +2 -2
  121. stadiamaps/models/travel_mode.py +1 -1
  122. stadiamaps/models/traversability.py +1 -1
  123. stadiamaps/models/truck_costing_options.py +1 -1
  124. stadiamaps/models/tz_response.py +1 -1
  125. stadiamaps/models/valhalla_languages.py +1 -1
  126. stadiamaps/models/valhalla_long_units.py +1 -1
  127. stadiamaps/models/warning.py +1 -1
  128. stadiamaps/rest.py +1 -1
  129. {stadiamaps-3.2.1.dist-info → stadiamaps-4.0.0.dist-info}/METADATA +1 -1
  130. stadiamaps-4.0.0.dist-info/RECORD +160 -0
  131. {stadiamaps-3.2.1.dist-info → stadiamaps-4.0.0.dist-info}/WHEEL +1 -1
  132. stadiamaps-3.2.1.dist-info/RECORD +0 -139
  133. {stadiamaps-3.2.1.dist-info → stadiamaps-4.0.0.dist-info}/LICENSE.txt +0 -0
  134. {stadiamaps-3.2.1.dist-info → stadiamaps-4.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,119 @@
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: 7.0.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, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from stadiamaps.models.osrm_route_leg import OsrmRouteLeg
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class OsrmRoute(BaseModel):
28
+ """
29
+ OsrmRoute
30
+ """ # noqa: E501
31
+ distance: Union[StrictFloat, StrictInt] = Field(description="The distance traveled by the route, in meters.")
32
+ duration: Union[StrictFloat, StrictInt] = Field(description="The estimated travel time, in number of seconds.")
33
+ geometry: StrictStr = Field(description="An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm).")
34
+ weight: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total cost of the route computed by the routing engine.")
35
+ weight_name: Optional[StrictStr] = Field(default=None, description="The costing model used for the route.")
36
+ legs: List[OsrmRouteLeg]
37
+ additional_properties: Dict[str, Any] = {}
38
+ __properties: ClassVar[List[str]] = ["distance", "duration", "geometry", "weight", "weight_name", "legs"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of OsrmRoute from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ * Fields in `self.additional_properties` are added to the output dict.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ "additional_properties",
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # override the default output from pydantic by calling `to_dict()` of each item in legs (list)
82
+ _items = []
83
+ if self.legs:
84
+ for _item_legs in self.legs:
85
+ if _item_legs:
86
+ _items.append(_item_legs.to_dict())
87
+ _dict['legs'] = _items
88
+ # puts key-value pairs in additional_properties in the top level
89
+ if self.additional_properties is not None:
90
+ for _key, _value in self.additional_properties.items():
91
+ _dict[_key] = _value
92
+
93
+ return _dict
94
+
95
+ @classmethod
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
+ """Create an instance of OsrmRoute from a dict"""
98
+ if obj is None:
99
+ return None
100
+
101
+ if not isinstance(obj, dict):
102
+ return cls.model_validate(obj)
103
+
104
+ _obj = cls.model_validate({
105
+ "distance": obj.get("distance"),
106
+ "duration": obj.get("duration"),
107
+ "geometry": obj.get("geometry"),
108
+ "weight": obj.get("weight"),
109
+ "weight_name": obj.get("weight_name"),
110
+ "legs": [OsrmRouteLeg.from_dict(_item) for _item in obj["legs"]] if obj.get("legs") is not None else None
111
+ })
112
+ # store additional fields in additional_properties
113
+ for _key in obj.keys():
114
+ if _key not in cls.__properties:
115
+ _obj.additional_properties[_key] = obj.get(_key)
116
+
117
+ return _obj
118
+
119
+
@@ -0,0 +1,148 @@
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: 7.0.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, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from stadiamaps.models.osrm_admin import OsrmAdmin
24
+ from stadiamaps.models.osrm_annotation import OsrmAnnotation
25
+ from stadiamaps.models.osrm_route_step import OsrmRouteStep
26
+ from stadiamaps.models.osrm_via_waypoint import OsrmViaWaypoint
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class OsrmRouteLeg(BaseModel):
31
+ """
32
+ OsrmRouteLeg
33
+ """ # noqa: E501
34
+ distance: Union[StrictFloat, StrictInt] = Field(description="The distance traveled by the route, in meters.")
35
+ duration: Union[StrictFloat, StrictInt] = Field(description="The estimated travel time, in number of seconds.")
36
+ weight: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total cost of the leg computed by the routing engine.")
37
+ summary: Optional[StrictStr] = None
38
+ steps: List[OsrmRouteStep]
39
+ annotation: Optional[OsrmAnnotation] = None
40
+ via_waypoints: Optional[List[OsrmViaWaypoint]] = Field(default=None, description="Indicates which waypoints are passed through rather than creating a new leg.")
41
+ admins: Optional[List[OsrmAdmin]] = Field(default=None, description="Administrative regions visited along the leg.")
42
+ additional_properties: Dict[str, Any] = {}
43
+ __properties: ClassVar[List[str]] = ["distance", "duration", "weight", "summary", "steps", "annotation", "via_waypoints", "admins"]
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 OsrmRouteLeg 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 steps (list)
87
+ _items = []
88
+ if self.steps:
89
+ for _item_steps in self.steps:
90
+ if _item_steps:
91
+ _items.append(_item_steps.to_dict())
92
+ _dict['steps'] = _items
93
+ # override the default output from pydantic by calling `to_dict()` of annotation
94
+ if self.annotation:
95
+ _dict['annotation'] = self.annotation.to_dict()
96
+ # override the default output from pydantic by calling `to_dict()` of each item in via_waypoints (list)
97
+ _items = []
98
+ if self.via_waypoints:
99
+ for _item_via_waypoints in self.via_waypoints:
100
+ if _item_via_waypoints:
101
+ _items.append(_item_via_waypoints.to_dict())
102
+ _dict['via_waypoints'] = _items
103
+ # override the default output from pydantic by calling `to_dict()` of each item in admins (list)
104
+ _items = []
105
+ if self.admins:
106
+ for _item_admins in self.admins:
107
+ if _item_admins:
108
+ _items.append(_item_admins.to_dict())
109
+ _dict['admins'] = _items
110
+ # puts key-value pairs in additional_properties in the top level
111
+ if self.additional_properties is not None:
112
+ for _key, _value in self.additional_properties.items():
113
+ _dict[_key] = _value
114
+
115
+ # set to None if via_waypoints (nullable) is None
116
+ # and model_fields_set contains the field
117
+ if self.via_waypoints is None and "via_waypoints" in self.model_fields_set:
118
+ _dict['via_waypoints'] = None
119
+
120
+ return _dict
121
+
122
+ @classmethod
123
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
124
+ """Create an instance of OsrmRouteLeg from a dict"""
125
+ if obj is None:
126
+ return None
127
+
128
+ if not isinstance(obj, dict):
129
+ return cls.model_validate(obj)
130
+
131
+ _obj = cls.model_validate({
132
+ "distance": obj.get("distance"),
133
+ "duration": obj.get("duration"),
134
+ "weight": obj.get("weight"),
135
+ "summary": obj.get("summary"),
136
+ "steps": [OsrmRouteStep.from_dict(_item) for _item in obj["steps"]] if obj.get("steps") is not None else None,
137
+ "annotation": OsrmAnnotation.from_dict(obj["annotation"]) if obj.get("annotation") is not None else None,
138
+ "via_waypoints": [OsrmViaWaypoint.from_dict(_item) for _item in obj["via_waypoints"]] if obj.get("via_waypoints") is not None else None,
139
+ "admins": [OsrmAdmin.from_dict(_item) for _item in obj["admins"]] if obj.get("admins") is not None else None
140
+ })
141
+ # store additional fields in additional_properties
142
+ for _key in obj.keys():
143
+ if _key not in cls.__properties:
144
+ _obj.additional_properties[_key] = obj.get(_key)
145
+
146
+ return _obj
147
+
148
+
@@ -0,0 +1,132 @@
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: 7.0.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, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from stadiamaps.models.osrm_route import OsrmRoute
24
+ from stadiamaps.models.osrm_waypoint import OsrmWaypoint
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class OsrmRouteResponse(BaseModel):
29
+ """
30
+ OsrmRouteResponse
31
+ """ # noqa: E501
32
+ code: StrictStr
33
+ message: Optional[StrictStr] = None
34
+ data_version: Optional[StrictStr] = None
35
+ waypoints: Optional[List[OsrmWaypoint]] = None
36
+ routes: Optional[List[OsrmRoute]] = None
37
+ additional_properties: Dict[str, Any] = {}
38
+ __properties: ClassVar[List[str]] = ["code", "message", "data_version", "waypoints", "routes"]
39
+
40
+ @field_validator('code')
41
+ def code_validate_enum(cls, value):
42
+ """Validates the enum"""
43
+ if value not in set(['Ok', 'InvalidUrl', 'InvalidService', 'InvalidVersion', 'InvalidOptions', 'InvalidQuery', 'InvalidValue', 'NoSegment', 'TooBig', 'NoRoute', 'NoTable', 'NotImplemented', 'NoTrips']):
44
+ raise ValueError("must be one of enum values ('Ok', 'InvalidUrl', 'InvalidService', 'InvalidVersion', 'InvalidOptions', 'InvalidQuery', 'InvalidValue', 'NoSegment', 'TooBig', 'NoRoute', 'NoTable', 'NotImplemented', 'NoTrips')")
45
+ return value
46
+
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of OsrmRouteResponse from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ * Fields in `self.additional_properties` are added to the output dict.
78
+ """
79
+ excluded_fields: Set[str] = set([
80
+ "additional_properties",
81
+ ])
82
+
83
+ _dict = self.model_dump(
84
+ by_alias=True,
85
+ exclude=excluded_fields,
86
+ exclude_none=True,
87
+ )
88
+ # override the default output from pydantic by calling `to_dict()` of each item in waypoints (list)
89
+ _items = []
90
+ if self.waypoints:
91
+ for _item_waypoints in self.waypoints:
92
+ if _item_waypoints:
93
+ _items.append(_item_waypoints.to_dict())
94
+ _dict['waypoints'] = _items
95
+ # override the default output from pydantic by calling `to_dict()` of each item in routes (list)
96
+ _items = []
97
+ if self.routes:
98
+ for _item_routes in self.routes:
99
+ if _item_routes:
100
+ _items.append(_item_routes.to_dict())
101
+ _dict['routes'] = _items
102
+ # puts key-value pairs in additional_properties in the top level
103
+ if self.additional_properties is not None:
104
+ for _key, _value in self.additional_properties.items():
105
+ _dict[_key] = _value
106
+
107
+ return _dict
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111
+ """Create an instance of OsrmRouteResponse from a dict"""
112
+ if obj is None:
113
+ return None
114
+
115
+ if not isinstance(obj, dict):
116
+ return cls.model_validate(obj)
117
+
118
+ _obj = cls.model_validate({
119
+ "code": obj.get("code"),
120
+ "message": obj.get("message"),
121
+ "data_version": obj.get("data_version"),
122
+ "waypoints": [OsrmWaypoint.from_dict(_item) for _item in obj["waypoints"]] if obj.get("waypoints") is not None else None,
123
+ "routes": [OsrmRoute.from_dict(_item) for _item in obj["routes"]] if obj.get("routes") is not None else None
124
+ })
125
+ # store additional fields in additional_properties
126
+ for _key in obj.keys():
127
+ if _key not in cls.__properties:
128
+ _obj.additional_properties[_key] = obj.get(_key)
129
+
130
+ return _obj
131
+
132
+
@@ -0,0 +1,185 @@
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: 7.0.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, StrictFloat, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from stadiamaps.models.osrm_banner_instruction import OsrmBannerInstruction
24
+ from stadiamaps.models.osrm_intersection import OsrmIntersection
25
+ from stadiamaps.models.osrm_step_maneuver import OsrmStepManeuver
26
+ from stadiamaps.models.osrm_voice_instruction import OsrmVoiceInstruction
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class OsrmRouteStep(BaseModel):
31
+ """
32
+ A maneuver such as a turn or merge, followed by travel along a single road or path.
33
+ """ # noqa: E501
34
+ distance: Union[StrictFloat, StrictInt] = Field(description="The distance traveled by the route, in meters.")
35
+ duration: Union[StrictFloat, StrictInt] = Field(description="The estimated travel time, in number of seconds.")
36
+ geometry: StrictStr = Field(description="An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm) with 6 digits of decimal precision.")
37
+ weight: Optional[Union[StrictFloat, StrictInt]] = None
38
+ name: Optional[StrictStr] = Field(default=None, description="The name of the segment (ex: road) being traversed")
39
+ ref: Optional[StrictStr] = Field(default=None, description="A reference number of code for the segment being traversed.")
40
+ pronunciation: Optional[StrictStr] = Field(default=None, description="Pronunciation of the name (if available). The format of this varies by implementation/vendor.")
41
+ destinations: Optional[StrictStr] = None
42
+ exits: Optional[StrictStr] = None
43
+ mode: StrictStr = Field(description="The mode of travel.")
44
+ maneuver: OsrmStepManeuver
45
+ intersections: Optional[List[OsrmIntersection]] = None
46
+ rotary_name: Optional[StrictStr] = Field(default=None, description="The name of the traffic circle.")
47
+ rotary_pronunciation: Optional[StrictStr] = Field(default=None, description="Pronunciation of the rotary name (if available). The format of this varies by implementation/vendor.")
48
+ driving_side: Optional[StrictStr] = Field(default=None, description="The side of the road on which driving is legal for this step.")
49
+ voice_instructions: Optional[List[OsrmVoiceInstruction]] = Field(default=None, description="A list of announcements which should be spoken at various points along the maneuver.", alias="voiceInstructions")
50
+ banner_instructions: Optional[List[OsrmBannerInstruction]] = Field(default=None, description="A list of announcements which should be displayed prominently on screen at various points along the maneuver.", alias="bannerInstructions")
51
+ speed_limit_sign: Optional[StrictStr] = Field(default=None, description="The style of speed limit signs used along the step.", alias="speedLimitSign")
52
+ speed_limit_unit: Optional[StrictStr] = Field(default=None, description="The unit of measure that is used locally along the step. This may be different from the unit used in maxspeed annotations, and is provided so that apps can localize their display.", alias="speedLimitUnit")
53
+ additional_properties: Dict[str, Any] = {}
54
+ __properties: ClassVar[List[str]] = ["distance", "duration", "geometry", "weight", "name", "ref", "pronunciation", "destinations", "exits", "mode", "maneuver", "intersections", "rotary_name", "rotary_pronunciation", "driving_side", "voiceInstructions", "bannerInstructions", "speedLimitSign", "speedLimitUnit"]
55
+
56
+ @field_validator('driving_side')
57
+ def driving_side_validate_enum(cls, value):
58
+ """Validates the enum"""
59
+ if value is None:
60
+ return value
61
+
62
+ if value not in set(['left', 'right']):
63
+ raise ValueError("must be one of enum values ('left', 'right')")
64
+ return value
65
+
66
+ @field_validator('speed_limit_sign')
67
+ def speed_limit_sign_validate_enum(cls, value):
68
+ """Validates the enum"""
69
+ if value is None:
70
+ return value
71
+
72
+ if value not in set(['mutcd', 'vienna']):
73
+ raise ValueError("must be one of enum values ('mutcd', 'vienna')")
74
+ return value
75
+
76
+ model_config = ConfigDict(
77
+ populate_by_name=True,
78
+ validate_assignment=True,
79
+ protected_namespaces=(),
80
+ )
81
+
82
+
83
+ def to_str(self) -> str:
84
+ """Returns the string representation of the model using alias"""
85
+ return pprint.pformat(self.model_dump(by_alias=True))
86
+
87
+ def to_json(self) -> str:
88
+ """Returns the JSON representation of the model using alias"""
89
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
90
+ return json.dumps(self.to_dict())
91
+
92
+ @classmethod
93
+ def from_json(cls, json_str: str) -> Optional[Self]:
94
+ """Create an instance of OsrmRouteStep from a JSON string"""
95
+ return cls.from_dict(json.loads(json_str))
96
+
97
+ def to_dict(self) -> Dict[str, Any]:
98
+ """Return the dictionary representation of the model using alias.
99
+
100
+ This has the following differences from calling pydantic's
101
+ `self.model_dump(by_alias=True)`:
102
+
103
+ * `None` is only added to the output dict for nullable fields that
104
+ were set at model initialization. Other fields with value `None`
105
+ are ignored.
106
+ * Fields in `self.additional_properties` are added to the output dict.
107
+ """
108
+ excluded_fields: Set[str] = set([
109
+ "additional_properties",
110
+ ])
111
+
112
+ _dict = self.model_dump(
113
+ by_alias=True,
114
+ exclude=excluded_fields,
115
+ exclude_none=True,
116
+ )
117
+ # override the default output from pydantic by calling `to_dict()` of maneuver
118
+ if self.maneuver:
119
+ _dict['maneuver'] = self.maneuver.to_dict()
120
+ # override the default output from pydantic by calling `to_dict()` of each item in intersections (list)
121
+ _items = []
122
+ if self.intersections:
123
+ for _item_intersections in self.intersections:
124
+ if _item_intersections:
125
+ _items.append(_item_intersections.to_dict())
126
+ _dict['intersections'] = _items
127
+ # override the default output from pydantic by calling `to_dict()` of each item in voice_instructions (list)
128
+ _items = []
129
+ if self.voice_instructions:
130
+ for _item_voice_instructions in self.voice_instructions:
131
+ if _item_voice_instructions:
132
+ _items.append(_item_voice_instructions.to_dict())
133
+ _dict['voiceInstructions'] = _items
134
+ # override the default output from pydantic by calling `to_dict()` of each item in banner_instructions (list)
135
+ _items = []
136
+ if self.banner_instructions:
137
+ for _item_banner_instructions in self.banner_instructions:
138
+ if _item_banner_instructions:
139
+ _items.append(_item_banner_instructions.to_dict())
140
+ _dict['bannerInstructions'] = _items
141
+ # puts key-value pairs in additional_properties in the top level
142
+ if self.additional_properties is not None:
143
+ for _key, _value in self.additional_properties.items():
144
+ _dict[_key] = _value
145
+
146
+ return _dict
147
+
148
+ @classmethod
149
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
150
+ """Create an instance of OsrmRouteStep from a dict"""
151
+ if obj is None:
152
+ return None
153
+
154
+ if not isinstance(obj, dict):
155
+ return cls.model_validate(obj)
156
+
157
+ _obj = cls.model_validate({
158
+ "distance": obj.get("distance"),
159
+ "duration": obj.get("duration"),
160
+ "geometry": obj.get("geometry"),
161
+ "weight": obj.get("weight"),
162
+ "name": obj.get("name"),
163
+ "ref": obj.get("ref"),
164
+ "pronunciation": obj.get("pronunciation"),
165
+ "destinations": obj.get("destinations"),
166
+ "exits": obj.get("exits"),
167
+ "mode": obj.get("mode"),
168
+ "maneuver": OsrmStepManeuver.from_dict(obj["maneuver"]) if obj.get("maneuver") is not None else None,
169
+ "intersections": [OsrmIntersection.from_dict(_item) for _item in obj["intersections"]] if obj.get("intersections") is not None else None,
170
+ "rotary_name": obj.get("rotary_name"),
171
+ "rotary_pronunciation": obj.get("rotary_pronunciation"),
172
+ "driving_side": obj.get("driving_side"),
173
+ "voiceInstructions": [OsrmVoiceInstruction.from_dict(_item) for _item in obj["voiceInstructions"]] if obj.get("voiceInstructions") is not None else None,
174
+ "bannerInstructions": [OsrmBannerInstruction.from_dict(_item) for _item in obj["bannerInstructions"]] if obj.get("bannerInstructions") is not None else None,
175
+ "speedLimitSign": obj.get("speedLimitSign"),
176
+ "speedLimitUnit": obj.get("speedLimitUnit")
177
+ })
178
+ # store additional fields in additional_properties
179
+ for _key in obj.keys():
180
+ if _key not in cls.__properties:
181
+ _obj.additional_properties[_key] = obj.get(_key)
182
+
183
+ return _obj
184
+
185
+