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.
Files changed (112) hide show
  1. stadiamaps/__init__.py +6 -24
  2. stadiamaps/api/geocoding_api.py +1917 -760
  3. stadiamaps/api/geospatial_api.py +483 -221
  4. stadiamaps/api/routing_api.py +1615 -723
  5. stadiamaps/api_client.py +275 -272
  6. stadiamaps/api_response.py +12 -16
  7. stadiamaps/configuration.py +13 -11
  8. stadiamaps/exceptions.py +67 -30
  9. stadiamaps/models/__init__.py +5 -23
  10. stadiamaps/models/access.py +44 -26
  11. stadiamaps/models/admin_region.py +46 -28
  12. stadiamaps/models/administrative.py +48 -30
  13. stadiamaps/models/auto_costing_options.py +75 -48
  14. stadiamaps/models/base_costing_options.py +59 -34
  15. stadiamaps/models/base_trace_request.py +70 -40
  16. stadiamaps/models/bicycle_costing_options.py +67 -42
  17. stadiamaps/models/bike_network.py +42 -24
  18. stadiamaps/models/contour.py +45 -27
  19. stadiamaps/models/coordinate.py +45 -26
  20. stadiamaps/models/costing_model.py +10 -12
  21. stadiamaps/models/costing_options.py +51 -33
  22. stadiamaps/models/directions_options.py +45 -27
  23. stadiamaps/models/distance_unit.py +8 -11
  24. stadiamaps/models/edge_sign.py +46 -28
  25. stadiamaps/models/edge_use.py +8 -11
  26. stadiamaps/models/end_node.py +48 -30
  27. stadiamaps/models/geo_attributes.py +47 -29
  28. stadiamaps/models/geo_json_geometry.py +25 -25
  29. stadiamaps/models/geo_json_geometry_base.py +45 -27
  30. stadiamaps/models/geo_json_line_string.py +47 -28
  31. stadiamaps/models/geo_json_line_string_all_of.py +1 -1
  32. stadiamaps/models/geo_json_point.py +47 -28
  33. stadiamaps/models/geo_json_point_all_of.py +1 -1
  34. stadiamaps/models/geo_json_polygon.py +47 -28
  35. stadiamaps/models/geo_json_polygon_all_of.py +1 -1
  36. stadiamaps/models/geocoding_object.py +46 -28
  37. stadiamaps/models/height_request.py +55 -34
  38. stadiamaps/models/height_response.py +49 -30
  39. stadiamaps/models/highway_classification.py +52 -34
  40. stadiamaps/models/intersecting_edge.py +45 -27
  41. stadiamaps/models/isochrone_costing_model.py +8 -11
  42. stadiamaps/models/isochrone_feature.py +45 -27
  43. stadiamaps/models/isochrone_properties.py +48 -30
  44. stadiamaps/models/isochrone_request.py +54 -35
  45. stadiamaps/models/isochrone_response.py +47 -29
  46. stadiamaps/models/locate_detailed_edge.py +73 -55
  47. stadiamaps/models/locate_edge.py +56 -39
  48. stadiamaps/models/locate_edge_info.py +47 -29
  49. stadiamaps/models/locate_node.py +50 -31
  50. stadiamaps/models/locate_object.py +49 -31
  51. stadiamaps/models/maneuver_sign.py +50 -32
  52. stadiamaps/models/maneuver_sign_element.py +45 -27
  53. stadiamaps/models/map_match_costing_model.py +8 -11
  54. stadiamaps/models/map_match_request.py +74 -44
  55. stadiamaps/models/map_match_route_response.py +57 -29
  56. stadiamaps/models/map_match_trace_options.py +47 -29
  57. stadiamaps/models/map_match_waypoint.py +49 -30
  58. stadiamaps/models/matched_point.py +52 -34
  59. stadiamaps/models/matrix_costing_model.py +9 -12
  60. stadiamaps/models/matrix_distance.py +46 -28
  61. stadiamaps/models/matrix_request.py +70 -39
  62. stadiamaps/models/matrix_response.py +60 -36
  63. stadiamaps/models/motor_scooter_costing_options.py +76 -49
  64. stadiamaps/models/motorcycle_costing_options.py +75 -48
  65. stadiamaps/models/nearest_roads_request.py +65 -34
  66. stadiamaps/models/node_id.py +42 -24
  67. stadiamaps/models/node_type.py +8 -11
  68. stadiamaps/models/optimized_route_request.py +66 -35
  69. stadiamaps/models/pedestrian_costing_options.py +59 -40
  70. stadiamaps/models/pelias_geo_json_feature.py +50 -31
  71. stadiamaps/models/pelias_geo_json_properties.py +54 -36
  72. stadiamaps/models/pelias_geo_json_properties_addendum.py +43 -25
  73. stadiamaps/models/pelias_geo_json_properties_addendum_osm.py +42 -24
  74. stadiamaps/models/pelias_layer.py +8 -11
  75. stadiamaps/models/pelias_response.py +49 -30
  76. stadiamaps/models/pelias_source.py +8 -11
  77. stadiamaps/models/restrictions.py +44 -26
  78. stadiamaps/models/road_class.py +8 -11
  79. stadiamaps/models/route_leg.py +48 -29
  80. stadiamaps/models/route_maneuver.py +73 -55
  81. stadiamaps/models/route_request.py +76 -43
  82. stadiamaps/models/route_response.py +56 -28
  83. stadiamaps/models/route_response_alternates_inner.py +105 -0
  84. stadiamaps/models/route_summary.py +48 -30
  85. stadiamaps/models/route_trip.py +135 -0
  86. stadiamaps/models/routing_response_waypoint.py +49 -30
  87. stadiamaps/models/routing_waypoint.py +60 -41
  88. stadiamaps/models/routing_waypoint_all_of_search_filter.py +48 -30
  89. stadiamaps/models/simple_routing_waypoint.py +48 -29
  90. stadiamaps/models/speeds.py +49 -31
  91. stadiamaps/models/trace_attribute_filter_options.py +47 -28
  92. stadiamaps/models/trace_attribute_key.py +8 -11
  93. stadiamaps/models/trace_attributes_base_response.py +51 -32
  94. stadiamaps/models/trace_attributes_request.py +72 -42
  95. stadiamaps/models/trace_attributes_request_all_of_filters.py +1 -1
  96. stadiamaps/models/trace_attributes_response.py +54 -35
  97. stadiamaps/models/trace_edge.py +88 -70
  98. stadiamaps/models/travel_mode.py +8 -11
  99. stadiamaps/models/traversability.py +8 -11
  100. stadiamaps/models/truck_costing_options.py +78 -51
  101. stadiamaps/models/tz_response.py +45 -27
  102. stadiamaps/models/valhalla_languages.py +8 -11
  103. stadiamaps/models/valhalla_long_units.py +8 -11
  104. stadiamaps/models/warning.py +42 -24
  105. stadiamaps/py.typed +0 -0
  106. stadiamaps/rest.py +127 -172
  107. {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/METADATA +4 -4
  108. stadiamaps-2.1.0.dist-info/RECORD +128 -0
  109. {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/WHEEL +1 -1
  110. stadiamaps-1.0.7.dist-info/RECORD +0 -125
  111. {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.0.dist-info}/LICENSE.txt +0 -0
  112. {stadiamaps-1.0.7.dist-info → stadiamaps-2.1.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. # noqa: E501
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: 5.0.6
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,96 +18,113 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import Optional
23
- from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.geo_attributes import GeoAttributes
25
24
  from stadiamaps.models.highway_classification import HighwayClassification
26
25
  from stadiamaps.models.node_id import NodeId
27
26
  from stadiamaps.models.restrictions import Restrictions
28
27
  from stadiamaps.models.speeds import Speeds
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
29
30
 
30
31
  class LocateDetailedEdge(BaseModel):
31
32
  """
32
33
  LocateDetailedEdge
33
- """
34
- sidewalk_left: Optional[StrictBool] = Field(None, description="Is there a sidewalk to the left of the edge?")
35
- sidewalk_right: Optional[StrictBool] = Field(None, description="Is there a sidewalk to the right of the edge?")
34
+ """ # noqa: E501
35
+ sidewalk_left: Optional[StrictBool] = Field(default=None, description="Is there a sidewalk to the left of the edge?")
36
+ sidewalk_right: Optional[StrictBool] = Field(default=None, description="Is there a sidewalk to the right of the edge?")
36
37
  lane_count: Optional[StrictInt] = None
37
- stop_sign: Optional[StrictBool] = Field(None, description="Is there a stop sign at end of the directed edge?")
38
+ stop_sign: Optional[StrictBool] = Field(default=None, description="Is there a stop sign at end of the directed edge?")
38
39
  sac_scale: Optional[StrictStr] = None
39
- yield_sign: Optional[StrictBool] = Field(None, description="Is there a yield sign at end of the directed edge?")
40
- not_thru: Optional[StrictBool] = Field(None, description="Does the edge lead to a \"no-through\" region?")
41
- forward: Optional[StrictBool] = Field(None, description="Is the edge info forward? If false, then reverse is implied.")
40
+ yield_sign: Optional[StrictBool] = Field(default=None, description="Is there a yield sign at end of the directed edge?")
41
+ not_thru: Optional[StrictBool] = Field(default=None, description="Does the edge lead to a \"no-through\" region?")
42
+ forward: Optional[StrictBool] = Field(default=None, description="Is the edge info forward? If false, then reverse is implied.")
42
43
  end_node: Optional[NodeId] = None
43
- truck_route: Optional[StrictBool] = Field(None, description="Is the edge part of a truck route/network?")
44
+ truck_route: Optional[StrictBool] = Field(default=None, description="Is the edge part of a truck route/network?")
44
45
  speeds: Optional[Speeds] = None
45
- bike_network: Optional[StrictBool] = Field(None, description="Is the edge part of a bicycle network?")
46
- round_about: Optional[StrictBool] = Field(None, description="Is the edge part of a roundabout?")
47
- traffic_signal: Optional[StrictBool] = Field(None, description="Is there a traffic signal at the end of the directed edge?")
48
- access_restriction: Optional[StrictBool] = Field(None, description="Is there a general restriction or access condition?")
49
- destination_only: Optional[StrictBool] = Field(None, description="Is the edge destination only? If so, it will not be routed through.")
46
+ bike_network: Optional[StrictBool] = Field(default=None, description="Is the edge part of a bicycle network?")
47
+ round_about: Optional[StrictBool] = Field(default=None, description="Is the edge part of a roundabout?")
48
+ traffic_signal: Optional[StrictBool] = Field(default=None, description="Is there a traffic signal at the end of the directed edge?")
49
+ access_restriction: Optional[StrictBool] = Field(default=None, description="Is there a general restriction or access condition?")
50
+ destination_only: Optional[StrictBool] = Field(default=None, description="Is the edge destination only? If so, it will not be routed through.")
50
51
  geo_attributes: Optional[GeoAttributes] = None
51
52
  start_restriction: Optional[Restrictions] = None
52
- cycle_lane: Optional[StrictStr] = Field(None, description="Indication of the type of cycle lane (if any) present along an edge.")
53
+ cycle_lane: Optional[StrictStr] = Field(default=None, description="Indication of the type of cycle lane (if any) present along an edge.")
53
54
  end_restriction: Optional[Restrictions] = None
54
- seasonal: Optional[StrictBool] = Field(None, description="Is access seasonal (ex. no access in winter)?")
55
- country_crossing: Optional[StrictBool] = Field(None, description="Does the edge cross into a new country?")
56
- part_of_complex_restriction: Optional[StrictBool] = Field(None, description="Is the edge part of a complex restriction?")
57
- has_sign: Optional[StrictBool] = Field(None, description="Do exit signs exist for the edge?")
55
+ seasonal: Optional[StrictBool] = Field(default=None, description="Is access seasonal (ex. no access in winter)?")
56
+ country_crossing: Optional[StrictBool] = Field(default=None, description="Does the edge cross into a new country?")
57
+ part_of_complex_restriction: Optional[StrictBool] = Field(default=None, description="Is the edge part of a complex restriction?")
58
+ has_sign: Optional[StrictBool] = Field(default=None, description="Do exit signs exist for the edge?")
58
59
  access: Optional[Restrictions] = None
59
- bridge: Optional[StrictBool] = Field(None, description="Is the edge part of a bridge?")
60
+ bridge: Optional[StrictBool] = Field(default=None, description="Is the edge part of a bridge?")
60
61
  classification: Optional[HighwayClassification] = None
61
- toll: Optional[StrictBool] = Field(None, description="Is the edge part of a toll road?")
62
- tunnel: Optional[StrictBool] = Field(None, description="Is the edge part of a tunnel?")
62
+ toll: Optional[StrictBool] = Field(default=None, description="Is the edge a toll road?")
63
+ tunnel: Optional[StrictBool] = Field(default=None, description="Is the edge a tunnel?")
63
64
  additional_properties: Dict[str, Any] = {}
64
- __properties = ["sidewalk_left", "sidewalk_right", "lane_count", "stop_sign", "sac_scale", "yield_sign", "not_thru", "forward", "end_node", "truck_route", "speeds", "bike_network", "round_about", "traffic_signal", "access_restriction", "destination_only", "geo_attributes", "start_restriction", "cycle_lane", "end_restriction", "seasonal", "country_crossing", "part_of_complex_restriction", "has_sign", "access", "bridge", "classification", "toll", "tunnel"]
65
+ __properties: ClassVar[List[str]] = ["sidewalk_left", "sidewalk_right", "lane_count", "stop_sign", "sac_scale", "yield_sign", "not_thru", "forward", "end_node", "truck_route", "speeds", "bike_network", "round_about", "traffic_signal", "access_restriction", "destination_only", "geo_attributes", "start_restriction", "cycle_lane", "end_restriction", "seasonal", "country_crossing", "part_of_complex_restriction", "has_sign", "access", "bridge", "classification", "toll", "tunnel"]
65
66
 
66
- @validator('sac_scale')
67
+ @field_validator('sac_scale')
67
68
  def sac_scale_validate_enum(cls, value):
68
69
  """Validates the enum"""
69
70
  if value is None:
70
71
  return value
71
72
 
72
- if value not in ('none', 'hiking', 'mountain hiking', 'demanding mountain hiking', 'alpine hiking', 'demanding alpine hiking', 'difficult alpine hiking'):
73
+ if value not in set(['none', 'hiking', 'mountain hiking', 'demanding mountain hiking', 'alpine hiking', 'demanding alpine hiking', 'difficult alpine hiking']):
73
74
  raise ValueError("must be one of enum values ('none', 'hiking', 'mountain hiking', 'demanding mountain hiking', 'alpine hiking', 'demanding alpine hiking', 'difficult alpine hiking')")
74
75
  return value
75
76
 
76
- @validator('cycle_lane')
77
+ @field_validator('cycle_lane')
77
78
  def cycle_lane_validate_enum(cls, value):
78
79
  """Validates the enum"""
79
80
  if value is None:
80
81
  return value
81
82
 
82
- if value not in ('none', 'shared', 'dedicated', 'separated'):
83
+ if value not in set(['none', 'shared', 'dedicated', 'separated']):
83
84
  raise ValueError("must be one of enum values ('none', 'shared', 'dedicated', 'separated')")
84
85
  return value
85
86
 
86
- class Config:
87
- """Pydantic configuration"""
88
- allow_population_by_field_name = True
89
- validate_assignment = True
87
+ model_config = ConfigDict(
88
+ populate_by_name=True,
89
+ validate_assignment=True,
90
+ protected_namespaces=(),
91
+ )
92
+
90
93
 
91
94
  def to_str(self) -> str:
92
95
  """Returns the string representation of the model using alias"""
93
- return pprint.pformat(self.dict(by_alias=True))
96
+ return pprint.pformat(self.model_dump(by_alias=True))
94
97
 
95
98
  def to_json(self) -> str:
96
99
  """Returns the JSON representation of the model using alias"""
100
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
97
101
  return json.dumps(self.to_dict())
98
102
 
99
103
  @classmethod
100
- def from_json(cls, json_str: str) -> LocateDetailedEdge:
104
+ def from_json(cls, json_str: str) -> Optional[Self]:
101
105
  """Create an instance of LocateDetailedEdge from a JSON string"""
102
106
  return cls.from_dict(json.loads(json_str))
103
107
 
104
- def to_dict(self):
105
- """Returns the dictionary representation of the model using alias"""
106
- _dict = self.dict(by_alias=True,
107
- exclude={
108
- "additional_properties"
109
- },
110
- exclude_none=True)
108
+ def to_dict(self) -> Dict[str, Any]:
109
+ """Return the dictionary representation of the model using alias.
110
+
111
+ This has the following differences from calling pydantic's
112
+ `self.model_dump(by_alias=True)`:
113
+
114
+ * `None` is only added to the output dict for nullable fields that
115
+ were set at model initialization. Other fields with value `None`
116
+ are ignored.
117
+ * Fields in `self.additional_properties` are added to the output dict.
118
+ """
119
+ excluded_fields: Set[str] = set([
120
+ "additional_properties",
121
+ ])
122
+
123
+ _dict = self.model_dump(
124
+ by_alias=True,
125
+ exclude=excluded_fields,
126
+ exclude_none=True,
127
+ )
111
128
  # override the default output from pydantic by calling `to_dict()` of end_node
112
129
  if self.end_node:
113
130
  _dict['end_node'] = self.end_node.to_dict()
@@ -137,15 +154,15 @@ class LocateDetailedEdge(BaseModel):
137
154
  return _dict
138
155
 
139
156
  @classmethod
140
- def from_dict(cls, obj: dict) -> LocateDetailedEdge:
157
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
141
158
  """Create an instance of LocateDetailedEdge from a dict"""
142
159
  if obj is None:
143
160
  return None
144
161
 
145
162
  if not isinstance(obj, dict):
146
- return LocateDetailedEdge.parse_obj(obj)
163
+ return cls.model_validate(obj)
147
164
 
148
- _obj = LocateDetailedEdge.parse_obj({
165
+ _obj = cls.model_validate({
149
166
  "sidewalk_left": obj.get("sidewalk_left"),
150
167
  "sidewalk_right": obj.get("sidewalk_right"),
151
168
  "lane_count": obj.get("lane_count"),
@@ -154,25 +171,25 @@ class LocateDetailedEdge(BaseModel):
154
171
  "yield_sign": obj.get("yield_sign"),
155
172
  "not_thru": obj.get("not_thru"),
156
173
  "forward": obj.get("forward"),
157
- "end_node": NodeId.from_dict(obj.get("end_node")) if obj.get("end_node") is not None else None,
174
+ "end_node": NodeId.from_dict(obj["end_node"]) if obj.get("end_node") is not None else None,
158
175
  "truck_route": obj.get("truck_route"),
159
- "speeds": Speeds.from_dict(obj.get("speeds")) if obj.get("speeds") is not None else None,
176
+ "speeds": Speeds.from_dict(obj["speeds"]) if obj.get("speeds") is not None else None,
160
177
  "bike_network": obj.get("bike_network"),
161
178
  "round_about": obj.get("round_about"),
162
179
  "traffic_signal": obj.get("traffic_signal"),
163
180
  "access_restriction": obj.get("access_restriction"),
164
181
  "destination_only": obj.get("destination_only"),
165
- "geo_attributes": GeoAttributes.from_dict(obj.get("geo_attributes")) if obj.get("geo_attributes") is not None else None,
166
- "start_restriction": Restrictions.from_dict(obj.get("start_restriction")) if obj.get("start_restriction") is not None else None,
182
+ "geo_attributes": GeoAttributes.from_dict(obj["geo_attributes"]) if obj.get("geo_attributes") is not None else None,
183
+ "start_restriction": Restrictions.from_dict(obj["start_restriction"]) if obj.get("start_restriction") is not None else None,
167
184
  "cycle_lane": obj.get("cycle_lane"),
168
- "end_restriction": Restrictions.from_dict(obj.get("end_restriction")) if obj.get("end_restriction") is not None else None,
185
+ "end_restriction": Restrictions.from_dict(obj["end_restriction"]) if obj.get("end_restriction") is not None else None,
169
186
  "seasonal": obj.get("seasonal"),
170
187
  "country_crossing": obj.get("country_crossing"),
171
188
  "part_of_complex_restriction": obj.get("part_of_complex_restriction"),
172
189
  "has_sign": obj.get("has_sign"),
173
- "access": Restrictions.from_dict(obj.get("access")) if obj.get("access") is not None else None,
190
+ "access": Restrictions.from_dict(obj["access"]) if obj.get("access") is not None else None,
174
191
  "bridge": obj.get("bridge"),
175
- "classification": HighwayClassification.from_dict(obj.get("classification")) if obj.get("classification") is not None else None,
192
+ "classification": HighwayClassification.from_dict(obj["classification"]) if obj.get("classification") is not None else None,
176
193
  "toll": obj.get("toll"),
177
194
  "tunnel": obj.get("tunnel")
178
195
  })
@@ -183,3 +200,4 @@ class LocateDetailedEdge(BaseModel):
183
200
 
184
201
  return _obj
185
202
 
203
+
@@ -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. # noqa: E501
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: 5.0.6
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,69 +18,84 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import List, Optional, Union
23
- from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
24
23
  from stadiamaps.models.locate_detailed_edge import LocateDetailedEdge
25
24
  from stadiamaps.models.locate_edge_info import LocateEdgeInfo
26
25
  from stadiamaps.models.node_id import NodeId
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
27
28
 
28
29
  class LocateEdge(BaseModel):
29
30
  """
30
31
  LocateEdge
31
- """
32
+ """ # noqa: E501
32
33
  edge_id: Optional[NodeId] = None
33
- correlated_lat: Optional[Union[StrictFloat, StrictInt]] = None
34
- correlated_lon: Optional[Union[StrictFloat, StrictInt]] = None
35
- percent_along: Optional[Union[StrictFloat, StrictInt]] = None
36
- side_of_street: Optional[StrictStr] = None
37
- linear_reference: Optional[StrictStr] = Field(None, description="A base64-encoded [OpenLR location reference](https://www.openlr-association.com/fileadmin/user_upload/openlr-whitepaper_v1.5.pdf), for a graph edge of the road network matched by the query.")
34
+ way_id: Optional[StrictInt] = Field(default=None, description="The OSM way ID associated with this edge (absent in verbose response; see the edge info).")
35
+ correlated_lat: Union[StrictFloat, StrictInt]
36
+ correlated_lon: Union[StrictFloat, StrictInt]
37
+ percent_along: Union[StrictFloat, StrictInt]
38
+ side_of_street: StrictStr
39
+ linear_reference: Optional[StrictStr] = Field(default=None, description="A base64-encoded [OpenLR location reference](https://www.openlr-association.com/fileadmin/user_upload/openlr-whitepaper_v1.5.pdf), for a graph edge of the road network matched by the query.")
38
40
  outbound_reach: Optional[StrictInt] = None
39
41
  heading: Optional[Union[StrictFloat, StrictInt]] = None
40
42
  inbound_reach: Optional[StrictInt] = None
41
43
  distance: Optional[Union[StrictFloat, StrictInt]] = None
42
- predicted_speeds: Optional[conlist(StrictInt)] = Field(None, description="Predicted speed information based on historical data. If available, this will include 2016 entries. Each entry represents 5 minutes, where the first entry represents midnight on Monday, the second entry represents 00:05 on Monday, etc.")
44
+ predicted_speeds: Optional[List[StrictInt]] = Field(default=None, description="Predicted speed information based on historical data. If available, this will include 2016 entries. Each entry represents 5 minutes, where the first entry represents midnight on Monday, the second entry represents 00:05 on Monday, etc.")
43
45
  edge_info: Optional[LocateEdgeInfo] = None
44
46
  edge: Optional[LocateDetailedEdge] = None
45
- warnings: Optional[conlist(StrictStr)] = None
47
+ warnings: Optional[List[StrictStr]] = None
46
48
  additional_properties: Dict[str, Any] = {}
47
- __properties = ["edge_id", "correlated_lat", "correlated_lon", "percent_along", "side_of_street", "linear_reference", "outbound_reach", "heading", "inbound_reach", "distance", "predicted_speeds", "edge_info", "edge", "warnings"]
49
+ __properties: ClassVar[List[str]] = ["edge_id", "way_id", "correlated_lat", "correlated_lon", "percent_along", "side_of_street", "linear_reference", "outbound_reach", "heading", "inbound_reach", "distance", "predicted_speeds", "edge_info", "edge", "warnings"]
48
50
 
49
- @validator('side_of_street')
51
+ @field_validator('side_of_street')
50
52
  def side_of_street_validate_enum(cls, value):
51
53
  """Validates the enum"""
52
- if value is None:
53
- return value
54
-
55
- if value not in ('left', 'right', 'neither'):
54
+ if value not in set(['left', 'right', 'neither']):
56
55
  raise ValueError("must be one of enum values ('left', 'right', 'neither')")
57
56
  return value
58
57
 
59
- class Config:
60
- """Pydantic configuration"""
61
- allow_population_by_field_name = True
62
- validate_assignment = True
58
+ model_config = ConfigDict(
59
+ populate_by_name=True,
60
+ validate_assignment=True,
61
+ protected_namespaces=(),
62
+ )
63
+
63
64
 
64
65
  def to_str(self) -> str:
65
66
  """Returns the string representation of the model using alias"""
66
- return pprint.pformat(self.dict(by_alias=True))
67
+ return pprint.pformat(self.model_dump(by_alias=True))
67
68
 
68
69
  def to_json(self) -> str:
69
70
  """Returns the JSON representation of the model using alias"""
71
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
72
  return json.dumps(self.to_dict())
71
73
 
72
74
  @classmethod
73
- def from_json(cls, json_str: str) -> LocateEdge:
75
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
76
  """Create an instance of LocateEdge from a JSON string"""
75
77
  return cls.from_dict(json.loads(json_str))
76
78
 
77
- def to_dict(self):
78
- """Returns the dictionary representation of the model using alias"""
79
- _dict = self.dict(by_alias=True,
80
- exclude={
81
- "additional_properties"
82
- },
83
- exclude_none=True)
79
+ def to_dict(self) -> Dict[str, Any]:
80
+ """Return the dictionary representation of the model using alias.
81
+
82
+ This has the following differences from calling pydantic's
83
+ `self.model_dump(by_alias=True)`:
84
+
85
+ * `None` is only added to the output dict for nullable fields that
86
+ were set at model initialization. Other fields with value `None`
87
+ are ignored.
88
+ * Fields in `self.additional_properties` are added to the output dict.
89
+ """
90
+ excluded_fields: Set[str] = set([
91
+ "additional_properties",
92
+ ])
93
+
94
+ _dict = self.model_dump(
95
+ by_alias=True,
96
+ exclude=excluded_fields,
97
+ exclude_none=True,
98
+ )
84
99
  # override the default output from pydantic by calling `to_dict()` of edge_id
85
100
  if self.edge_id:
86
101
  _dict['edge_id'] = self.edge_id.to_dict()
@@ -98,16 +113,17 @@ class LocateEdge(BaseModel):
98
113
  return _dict
99
114
 
100
115
  @classmethod
101
- def from_dict(cls, obj: dict) -> LocateEdge:
116
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
117
  """Create an instance of LocateEdge from a dict"""
103
118
  if obj is None:
104
119
  return None
105
120
 
106
121
  if not isinstance(obj, dict):
107
- return LocateEdge.parse_obj(obj)
122
+ return cls.model_validate(obj)
108
123
 
109
- _obj = LocateEdge.parse_obj({
110
- "edge_id": NodeId.from_dict(obj.get("edge_id")) if obj.get("edge_id") is not None else None,
124
+ _obj = cls.model_validate({
125
+ "edge_id": NodeId.from_dict(obj["edge_id"]) if obj.get("edge_id") is not None else None,
126
+ "way_id": obj.get("way_id"),
111
127
  "correlated_lat": obj.get("correlated_lat"),
112
128
  "correlated_lon": obj.get("correlated_lon"),
113
129
  "percent_along": obj.get("percent_along"),
@@ -118,8 +134,8 @@ class LocateEdge(BaseModel):
118
134
  "inbound_reach": obj.get("inbound_reach"),
119
135
  "distance": obj.get("distance"),
120
136
  "predicted_speeds": obj.get("predicted_speeds"),
121
- "edge_info": LocateEdgeInfo.from_dict(obj.get("edge_info")) if obj.get("edge_info") is not None else None,
122
- "edge": LocateDetailedEdge.from_dict(obj.get("edge")) if obj.get("edge") is not None else None,
137
+ "edge_info": LocateEdgeInfo.from_dict(obj["edge_info"]) if obj.get("edge_info") is not None else None,
138
+ "edge": LocateDetailedEdge.from_dict(obj["edge"]) if obj.get("edge") is not None else None,
123
139
  "warnings": obj.get("warnings")
124
140
  })
125
141
  # store additional fields in additional_properties
@@ -129,3 +145,4 @@ class LocateEdge(BaseModel):
129
145
 
130
146
  return _obj
131
147
 
148
+
@@ -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. # noqa: E501
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: 5.0.6
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 List, Optional, Union
23
- from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
24
23
  from stadiamaps.models.bike_network import BikeNetwork
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
25
26
 
26
27
  class LocateEdgeInfo(BaseModel):
27
28
  """
28
29
  LocateEdgeInfo
29
- """
30
- mean_elevation: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The mean elevation, in meters, relative to sea level.")
31
- shape: Optional[StrictStr] = Field(None, description="An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline is always encoded with 6 digits of precision, whereas most implementations default to 5.")
32
- names: Optional[conlist(StrictStr)] = Field(None, description="A list of names that the edge goes by.")
30
+ """ # noqa: E501
31
+ mean_elevation: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The mean elevation, in meters, relative to sea level.")
32
+ shape: StrictStr = Field(description="An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline is always encoded with 6 digits of precision, whereas most implementations default to 5.")
33
+ names: Optional[List[StrictStr]] = Field(default=None, description="A list of names that the edge goes by.")
33
34
  bike_network: Optional[BikeNetwork] = None
34
- way_id: Optional[StrictInt] = None
35
+ way_id: StrictInt = Field(description="The OSM way ID associated with this edge.")
35
36
  additional_properties: Dict[str, Any] = {}
36
- __properties = ["mean_elevation", "shape", "names", "bike_network", "way_id"]
37
+ __properties: ClassVar[List[str]] = ["mean_elevation", "shape", "names", "bike_network", "way_id"]
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.dict(by_alias=True))
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) -> LocateEdgeInfo:
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
57
  """Create an instance of LocateEdgeInfo from a JSON string"""
54
58
  return cls.from_dict(json.loads(json_str))
55
59
 
56
- def to_dict(self):
57
- """Returns the dictionary representation of the model using alias"""
58
- _dict = self.dict(by_alias=True,
59
- exclude={
60
- "additional_properties"
61
- },
62
- exclude_none=True)
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
  # override the default output from pydantic by calling `to_dict()` of bike_network
64
81
  if self.bike_network:
65
82
  _dict['bike_network'] = self.bike_network.to_dict()
@@ -71,19 +88,19 @@ class LocateEdgeInfo(BaseModel):
71
88
  return _dict
72
89
 
73
90
  @classmethod
74
- def from_dict(cls, obj: dict) -> LocateEdgeInfo:
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
92
  """Create an instance of LocateEdgeInfo from a dict"""
76
93
  if obj is None:
77
94
  return None
78
95
 
79
96
  if not isinstance(obj, dict):
80
- return LocateEdgeInfo.parse_obj(obj)
97
+ return cls.model_validate(obj)
81
98
 
82
- _obj = LocateEdgeInfo.parse_obj({
99
+ _obj = cls.model_validate({
83
100
  "mean_elevation": obj.get("mean_elevation"),
84
101
  "shape": obj.get("shape"),
85
102
  "names": obj.get("names"),
86
- "bike_network": BikeNetwork.from_dict(obj.get("bike_network")) if obj.get("bike_network") is not None else None,
103
+ "bike_network": BikeNetwork.from_dict(obj["bike_network"]) if obj.get("bike_network") is not None else None,
87
104
  "way_id": obj.get("way_id")
88
105
  })
89
106
  # store additional fields in additional_properties
@@ -93,3 +110,4 @@ class LocateEdgeInfo(BaseModel):
93
110
 
94
111
  return _obj
95
112
 
113
+