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,76 +18,94 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import Optional, Union
23
- from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conint, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing_extensions import Annotated
24
24
  from stadiamaps.models.routing_waypoint_all_of_search_filter import RoutingWaypointAllOfSearchFilter
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
25
27
 
26
28
  class RoutingWaypoint(BaseModel):
27
29
  """
28
30
  RoutingWaypoint
29
- """
30
- lat: Union[StrictFloat, StrictInt] = Field(..., description="The latitude of a point in the shape.")
31
- lon: Union[StrictFloat, StrictInt] = Field(..., description="The longitude of a point in the shape.")
32
- type: Optional[StrictStr] = Field('break', description="A `break` represents the start or end of a leg, and allows reversals. A `through` location is an intermediate waypoint that must be visited between `break`s, but at which reversals are not allowed. A `via` is similar to a `through` except that reversals are allowed. A `break_through` is similar to a `break` in that it can be the start/end of a leg, but does not allow reversals.")
33
- heading: Optional[conint(strict=True, le=360, ge=0)] = Field(None, description="The preferred direction of travel when starting the route, in integer clockwise degrees from north. North is 0, south is 180, east is 90, and west is 270.")
34
- heading_tolerance: Optional[conint(strict=True, le=360, ge=0)] = Field(60, description="The tolerance (in degrees) determining whether a street is considered the same direction.")
35
- minimum_reachability: Optional[conint(strict=True, ge=0)] = Field(50, description="The minimum number of nodes that must be reachable for a given edge to consider that edge as belonging to a connected region. If a candidate edge has fewer connections, it will be considered a disconnected island.")
36
- radius: Optional[conint(strict=True, ge=0)] = Field(0, description="The distance (in meters) to look for candidate edges around the location for purposes of snapping locations to the route graph. If there are no candidates within this distance, the closest candidate within a reasonable search distance will be used. This is subject to clamping by internal limits.")
37
- rank_candidates: Optional[StrictBool] = Field(True, description="If true, candidates will be ranked according to their distance from the target location as well as other factors. If false, candidates will only be ranked using their distance from the target.")
38
- preferred_side: Optional[StrictStr] = Field(None, description="If the location is not offset from the road centerline or is closest to an intersection, this option has no effect. Otherwise, the preferred side of street is used to determine whether or not the location should be visited from the same, opposite or either side of the road with respect to the side of the road the given locale drives on.")
39
- node_snap_tolerance: Optional[conint(strict=True, ge=0)] = Field(5, description="During edge correlation this is the tolerance (in meters) used to determine whether or not to snap to the intersection rather than along the street, if the snap location is within this distance from the intersection, the intersection is used instead.")
40
- street_side_tolerance: Optional[conint(strict=True, ge=0)] = Field(5, description="A tolerance in meters from the edge centerline used for determining the side of the street that the location is on. If the distance to the centerline is less than this tolerance, no side will be inferred. Otherwise, the left or right side will be selected depending on the direction of travel.")
41
- street_side_max_distance: Optional[conint(strict=True, ge=0)] = Field(1000, description="A tolerance in meters from the edge centerline used for determining the side of the street that the location is on. If the distance to the centerline is greater than this tolerance, no side will be inferred. Otherwise, the left or right side will be selected depending on the direction of travel.")
31
+ """ # noqa: E501
32
+ lat: Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]] = Field(description="The latitude of a point in the shape.")
33
+ lon: Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]] = Field(description="The longitude of a point in the shape.")
34
+ type: Optional[StrictStr] = Field(default='break', description="A `break` represents the start or end of a leg, and allows reversals. A `through` location is an intermediate waypoint that must be visited between `break`s, but at which reversals are not allowed. A `via` is similar to a `through` except that reversals are allowed. A `break_through` is similar to a `break` in that it can be the start/end of a leg, but does not allow reversals.")
35
+ heading: Optional[Annotated[int, Field(le=360, strict=True, ge=0)]] = Field(default=None, description="The preferred direction of travel when starting the route, in integer clockwise degrees from north. North is 0, south is 180, east is 90, and west is 270.")
36
+ heading_tolerance: Optional[Annotated[int, Field(le=360, strict=True, ge=0)]] = Field(default=60, description="The tolerance (in degrees) determining whether a street is considered the same direction.")
37
+ minimum_reachability: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=50, description="The minimum number of nodes that must be reachable for a given edge to consider that edge as belonging to a connected region. If a candidate edge has fewer connections, it will be considered a disconnected island.")
38
+ radius: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=0, description="The distance (in meters) to look for candidate edges around the location for purposes of snapping locations to the route graph. If there are no candidates within this distance, the closest candidate within a reasonable search distance will be used. This is subject to clamping by internal limits.")
39
+ rank_candidates: Optional[StrictBool] = Field(default=True, description="If true, candidates will be ranked according to their distance from the target location as well as other factors. If false, candidates will only be ranked using their distance from the target.")
40
+ preferred_side: Optional[StrictStr] = Field(default=None, description="If the location is not offset from the road centerline or is closest to an intersection, this option has no effect. Otherwise, the preferred side of street is used to determine whether or not the location should be visited from the same, opposite or either side of the road with respect to the side of the road the given locale drives on.")
41
+ node_snap_tolerance: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=5, description="During edge correlation this is the tolerance (in meters) used to determine whether or not to snap to the intersection rather than along the street, if the snap location is within this distance from the intersection, the intersection is used instead.")
42
+ street_side_tolerance: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=5, description="A tolerance in meters from the edge centerline used for determining the side of the street that the location is on. If the distance to the centerline is less than this tolerance, no side will be inferred. Otherwise, the left or right side will be selected depending on the direction of travel.")
43
+ street_side_max_distance: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=1000, description="A tolerance in meters from the edge centerline used for determining the side of the street that the location is on. If the distance to the centerline is greater than this tolerance, no side will be inferred. Otherwise, the left or right side will be selected depending on the direction of travel.")
42
44
  search_filter: Optional[RoutingWaypointAllOfSearchFilter] = None
43
45
  additional_properties: Dict[str, Any] = {}
44
- __properties = ["lat", "lon", "type", "heading", "heading_tolerance", "minimum_reachability", "radius", "rank_candidates", "preferred_side", "node_snap_tolerance", "street_side_tolerance", "street_side_max_distance", "search_filter"]
46
+ __properties: ClassVar[List[str]] = ["lat", "lon", "type", "heading", "heading_tolerance", "minimum_reachability", "radius", "rank_candidates", "preferred_side", "node_snap_tolerance", "street_side_tolerance", "street_side_max_distance", "search_filter"]
45
47
 
46
- @validator('type')
48
+ @field_validator('type')
47
49
  def type_validate_enum(cls, value):
48
50
  """Validates the enum"""
49
51
  if value is None:
50
52
  return value
51
53
 
52
- if value not in ('break', 'through', 'via', 'break_through'):
54
+ if value not in set(['break', 'through', 'via', 'break_through']):
53
55
  raise ValueError("must be one of enum values ('break', 'through', 'via', 'break_through')")
54
56
  return value
55
57
 
56
- @validator('preferred_side')
58
+ @field_validator('preferred_side')
57
59
  def preferred_side_validate_enum(cls, value):
58
60
  """Validates the enum"""
59
61
  if value is None:
60
62
  return value
61
63
 
62
- if value not in ('same', 'opposite', 'either'):
64
+ if value not in set(['same', 'opposite', 'either']):
63
65
  raise ValueError("must be one of enum values ('same', 'opposite', 'either')")
64
66
  return value
65
67
 
66
- class Config:
67
- """Pydantic configuration"""
68
- allow_population_by_field_name = True
69
- validate_assignment = True
68
+ model_config = ConfigDict(
69
+ populate_by_name=True,
70
+ validate_assignment=True,
71
+ protected_namespaces=(),
72
+ )
73
+
70
74
 
71
75
  def to_str(self) -> str:
72
76
  """Returns the string representation of the model using alias"""
73
- return pprint.pformat(self.dict(by_alias=True))
77
+ return pprint.pformat(self.model_dump(by_alias=True))
74
78
 
75
79
  def to_json(self) -> str:
76
80
  """Returns the JSON representation of the model using alias"""
81
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
77
82
  return json.dumps(self.to_dict())
78
83
 
79
84
  @classmethod
80
- def from_json(cls, json_str: str) -> RoutingWaypoint:
85
+ def from_json(cls, json_str: str) -> Optional[Self]:
81
86
  """Create an instance of RoutingWaypoint from a JSON string"""
82
87
  return cls.from_dict(json.loads(json_str))
83
88
 
84
- def to_dict(self):
85
- """Returns the dictionary representation of the model using alias"""
86
- _dict = self.dict(by_alias=True,
87
- exclude={
88
- "additional_properties"
89
- },
90
- exclude_none=True)
89
+ def to_dict(self) -> Dict[str, Any]:
90
+ """Return the dictionary representation of the model using alias.
91
+
92
+ This has the following differences from calling pydantic's
93
+ `self.model_dump(by_alias=True)`:
94
+
95
+ * `None` is only added to the output dict for nullable fields that
96
+ were set at model initialization. Other fields with value `None`
97
+ are ignored.
98
+ * Fields in `self.additional_properties` are added to the output dict.
99
+ """
100
+ excluded_fields: Set[str] = set([
101
+ "additional_properties",
102
+ ])
103
+
104
+ _dict = self.model_dump(
105
+ by_alias=True,
106
+ exclude=excluded_fields,
107
+ exclude_none=True,
108
+ )
91
109
  # override the default output from pydantic by calling `to_dict()` of search_filter
92
110
  if self.search_filter:
93
111
  _dict['search_filter'] = self.search_filter.to_dict()
@@ -99,15 +117,15 @@ class RoutingWaypoint(BaseModel):
99
117
  return _dict
100
118
 
101
119
  @classmethod
102
- def from_dict(cls, obj: dict) -> RoutingWaypoint:
120
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
103
121
  """Create an instance of RoutingWaypoint from a dict"""
104
122
  if obj is None:
105
123
  return None
106
124
 
107
125
  if not isinstance(obj, dict):
108
- return RoutingWaypoint.parse_obj(obj)
126
+ return cls.model_validate(obj)
109
127
 
110
- _obj = RoutingWaypoint.parse_obj({
128
+ _obj = cls.model_validate({
111
129
  "lat": obj.get("lat"),
112
130
  "lon": obj.get("lon"),
113
131
  "type": obj.get("type") if obj.get("type") is not None else 'break',
@@ -120,7 +138,7 @@ class RoutingWaypoint(BaseModel):
120
138
  "node_snap_tolerance": obj.get("node_snap_tolerance") if obj.get("node_snap_tolerance") is not None else 5,
121
139
  "street_side_tolerance": obj.get("street_side_tolerance") if obj.get("street_side_tolerance") is not None else 5,
122
140
  "street_side_max_distance": obj.get("street_side_max_distance") if obj.get("street_side_max_distance") is not None else 1000,
123
- "search_filter": RoutingWaypointAllOfSearchFilter.from_dict(obj.get("search_filter")) if obj.get("search_filter") is not None else None
141
+ "search_filter": RoutingWaypointAllOfSearchFilter.from_dict(obj["search_filter"]) if obj.get("search_filter") is not None else None
124
142
  })
125
143
  # store additional fields in additional_properties
126
144
  for _key in obj.keys():
@@ -129,3 +147,4 @@ class RoutingWaypoint(BaseModel):
129
147
 
130
148
  return _obj
131
149
 
150
+
@@ -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,49 +18,66 @@ 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
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.road_class import RoadClass
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
25
26
 
26
27
  class RoutingWaypointAllOfSearchFilter(BaseModel):
27
28
  """
28
29
  RoutingWaypointAllOfSearchFilter
29
- """
30
- exclude_tunnel: Optional[StrictBool] = Field(False, description="Excludes roads marked as tunnels")
31
- exclude_bridge: Optional[StrictBool] = Field(False, description="Excludes roads marked as bridges")
32
- exclude_ramp: Optional[StrictBool] = Field(False, description="Excludes roads marked as ramps")
33
- exclude_closures: Optional[StrictBool] = Field(True, description="Excludes roads marked as closed")
34
- min_road_class: Optional[RoadClass] = None
35
- max_road_class: Optional[RoadClass] = None
30
+ """ # noqa: E501
31
+ exclude_tunnel: Optional[StrictBool] = Field(default=False, description="Excludes roads marked as tunnels")
32
+ exclude_bridge: Optional[StrictBool] = Field(default=False, description="Excludes roads marked as bridges")
33
+ exclude_ramp: Optional[StrictBool] = Field(default=False, description="Excludes roads marked as ramps")
34
+ exclude_closures: Optional[StrictBool] = Field(default=True, description="Excludes roads marked as closed")
35
+ min_road_class: Optional[RoadClass] = Field(default=None, description="The lowest road class allowed")
36
+ max_road_class: Optional[RoadClass] = Field(default=None, description="The highest road class allowed")
36
37
  additional_properties: Dict[str, Any] = {}
37
- __properties = ["exclude_tunnel", "exclude_bridge", "exclude_ramp", "exclude_closures", "min_road_class", "max_road_class"]
38
+ __properties: ClassVar[List[str]] = ["exclude_tunnel", "exclude_bridge", "exclude_ramp", "exclude_closures", "min_road_class", "max_road_class"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
38
45
 
39
- class Config:
40
- """Pydantic configuration"""
41
- allow_population_by_field_name = True
42
- validate_assignment = True
43
46
 
44
47
  def to_str(self) -> str:
45
48
  """Returns the string representation of the model using alias"""
46
- return pprint.pformat(self.dict(by_alias=True))
49
+ return pprint.pformat(self.model_dump(by_alias=True))
47
50
 
48
51
  def to_json(self) -> str:
49
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
50
54
  return json.dumps(self.to_dict())
51
55
 
52
56
  @classmethod
53
- def from_json(cls, json_str: str) -> RoutingWaypointAllOfSearchFilter:
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
58
  """Create an instance of RoutingWaypointAllOfSearchFilter from a JSON string"""
55
59
  return cls.from_dict(json.loads(json_str))
56
60
 
57
- def to_dict(self):
58
- """Returns the dictionary representation of the model using alias"""
59
- _dict = self.dict(by_alias=True,
60
- exclude={
61
- "additional_properties"
62
- },
63
- exclude_none=True)
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
+ )
64
81
  # puts key-value pairs in additional_properties in the top level
65
82
  if self.additional_properties is not None:
66
83
  for _key, _value in self.additional_properties.items():
@@ -69,15 +86,15 @@ class RoutingWaypointAllOfSearchFilter(BaseModel):
69
86
  return _dict
70
87
 
71
88
  @classmethod
72
- def from_dict(cls, obj: dict) -> RoutingWaypointAllOfSearchFilter:
89
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
73
90
  """Create an instance of RoutingWaypointAllOfSearchFilter from a dict"""
74
91
  if obj is None:
75
92
  return None
76
93
 
77
94
  if not isinstance(obj, dict):
78
- return RoutingWaypointAllOfSearchFilter.parse_obj(obj)
95
+ return cls.model_validate(obj)
79
96
 
80
- _obj = RoutingWaypointAllOfSearchFilter.parse_obj({
97
+ _obj = cls.model_validate({
81
98
  "exclude_tunnel": obj.get("exclude_tunnel") if obj.get("exclude_tunnel") is not None else False,
82
99
  "exclude_bridge": obj.get("exclude_bridge") if obj.get("exclude_bridge") is not None else False,
83
100
  "exclude_ramp": obj.get("exclude_ramp") if obj.get("exclude_ramp") is not None else False,
@@ -92,3 +109,4 @@ class RoutingWaypointAllOfSearchFilter(BaseModel):
92
109
 
93
110
  return _obj
94
111
 
112
+
@@ -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,55 +18,73 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import Optional, Union
23
- from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
24
26
 
25
27
  class SimpleRoutingWaypoint(BaseModel):
26
28
  """
27
29
  SimpleRoutingWaypoint
28
- """
29
- lat: Union[StrictFloat, StrictInt] = Field(..., description="The latitude of a point in the shape.")
30
- lon: Union[StrictFloat, StrictInt] = Field(..., description="The longitude of a point in the shape.")
31
- type: Optional[StrictStr] = Field('break', description="A `break` represents the start or end of a leg, and allows reversals. A `through` location is an intermediate waypoint that must be visited between `break`s, but at which reversals are not allowed. A `via` is similar to a `through` except that reversals are allowed. A `break_through` is similar to a `break` in that it can be the start/end of a leg, but does not allow reversals.")
30
+ """ # noqa: E501
31
+ lat: Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]] = Field(description="The latitude of a point in the shape.")
32
+ lon: Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]] = Field(description="The longitude of a point in the shape.")
33
+ type: Optional[StrictStr] = Field(default='break', description="A `break` represents the start or end of a leg, and allows reversals. A `through` location is an intermediate waypoint that must be visited between `break`s, but at which reversals are not allowed. A `via` is similar to a `through` except that reversals are allowed. A `break_through` is similar to a `break` in that it can be the start/end of a leg, but does not allow reversals.")
32
34
  additional_properties: Dict[str, Any] = {}
33
- __properties = ["lat", "lon", "type"]
35
+ __properties: ClassVar[List[str]] = ["lat", "lon", "type"]
34
36
 
35
- @validator('type')
37
+ @field_validator('type')
36
38
  def type_validate_enum(cls, value):
37
39
  """Validates the enum"""
38
40
  if value is None:
39
41
  return value
40
42
 
41
- if value not in ('break', 'through', 'via', 'break_through'):
43
+ if value not in set(['break', 'through', 'via', 'break_through']):
42
44
  raise ValueError("must be one of enum values ('break', 'through', 'via', 'break_through')")
43
45
  return value
44
46
 
45
- class Config:
46
- """Pydantic configuration"""
47
- allow_population_by_field_name = True
48
- validate_assignment = True
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
49
53
 
50
54
  def to_str(self) -> str:
51
55
  """Returns the string representation of the model using alias"""
52
- return pprint.pformat(self.dict(by_alias=True))
56
+ return pprint.pformat(self.model_dump(by_alias=True))
53
57
 
54
58
  def to_json(self) -> str:
55
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
56
61
  return json.dumps(self.to_dict())
57
62
 
58
63
  @classmethod
59
- def from_json(cls, json_str: str) -> SimpleRoutingWaypoint:
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
65
  """Create an instance of SimpleRoutingWaypoint from a JSON string"""
61
66
  return cls.from_dict(json.loads(json_str))
62
67
 
63
- def to_dict(self):
64
- """Returns the dictionary representation of the model using alias"""
65
- _dict = self.dict(by_alias=True,
66
- exclude={
67
- "additional_properties"
68
- },
69
- exclude_none=True)
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
+ )
70
88
  # puts key-value pairs in additional_properties in the top level
71
89
  if self.additional_properties is not None:
72
90
  for _key, _value in self.additional_properties.items():
@@ -75,15 +93,15 @@ class SimpleRoutingWaypoint(BaseModel):
75
93
  return _dict
76
94
 
77
95
  @classmethod
78
- def from_dict(cls, obj: dict) -> SimpleRoutingWaypoint:
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
97
  """Create an instance of SimpleRoutingWaypoint from a dict"""
80
98
  if obj is None:
81
99
  return None
82
100
 
83
101
  if not isinstance(obj, dict):
84
- return SimpleRoutingWaypoint.parse_obj(obj)
102
+ return cls.model_validate(obj)
85
103
 
86
- _obj = SimpleRoutingWaypoint.parse_obj({
104
+ _obj = cls.model_validate({
87
105
  "lat": obj.get("lat"),
88
106
  "lon": obj.get("lon"),
89
107
  "type": obj.get("type") if obj.get("type") is not None else 'break'
@@ -95,3 +113,4 @@ class SimpleRoutingWaypoint(BaseModel):
95
113
 
96
114
  return _obj
97
115
 
116
+
@@ -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,57 +18,74 @@ 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
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
24
25
 
25
26
  class Speeds(BaseModel):
26
27
  """
27
28
  Speeds
28
- """
29
- predicted: Optional[StrictBool] = Field(None, description="Does this edge have predicted (historical) speed records?")
30
- constrained_flow: Optional[StrictInt] = Field(None, description="Speed when there is no traffic, in kph.")
31
- free_flow: Optional[StrictInt] = Field(None, description="Speed when there is heavy traffic, in kph.")
32
- type: Optional[StrictStr] = Field(None, description="The type of speed which is used when setting default speeds. When `tagged`, the explicit `max_speed` tags from OpenStreetMap are being used. When `classified`, the values are being inferred from the highway classification.")
33
- default: Optional[StrictInt] = Field(None, description="The default speed used for calculations. NOTE: Values greater than 250 are used for special cases and should not be treated as literal.")
29
+ """ # noqa: E501
30
+ predicted: Optional[StrictBool] = Field(default=None, description="Does this edge have predicted (historical) speed records?")
31
+ constrained_flow: Optional[StrictInt] = Field(default=None, description="Speed when there is no traffic, in kph.")
32
+ free_flow: Optional[StrictInt] = Field(default=None, description="Speed when there is heavy traffic, in kph.")
33
+ type: Optional[StrictStr] = Field(default=None, description="The type of speed which is used when setting default speeds. When `tagged`, the explicit `max_speed` tags from OpenStreetMap are being used. When `classified`, the values are being inferred from the highway classification.")
34
+ default: Optional[StrictInt] = Field(default=None, description="The default speed used for calculations. NOTE: Values greater than 250 are used for special cases and should not be treated as literal.")
34
35
  additional_properties: Dict[str, Any] = {}
35
- __properties = ["predicted", "constrained_flow", "free_flow", "type", "default"]
36
+ __properties: ClassVar[List[str]] = ["predicted", "constrained_flow", "free_flow", "type", "default"]
36
37
 
37
- @validator('type')
38
+ @field_validator('type')
38
39
  def type_validate_enum(cls, value):
39
40
  """Validates the enum"""
40
41
  if value is None:
41
42
  return value
42
43
 
43
- if value not in ('classified', 'tagged'):
44
+ if value not in set(['classified', 'tagged']):
44
45
  raise ValueError("must be one of enum values ('classified', 'tagged')")
45
46
  return value
46
47
 
47
- class Config:
48
- """Pydantic configuration"""
49
- allow_population_by_field_name = True
50
- validate_assignment = True
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
51
54
 
52
55
  def to_str(self) -> str:
53
56
  """Returns the string representation of the model using alias"""
54
- return pprint.pformat(self.dict(by_alias=True))
57
+ return pprint.pformat(self.model_dump(by_alias=True))
55
58
 
56
59
  def to_json(self) -> str:
57
60
  """Returns the JSON representation of the model using alias"""
61
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58
62
  return json.dumps(self.to_dict())
59
63
 
60
64
  @classmethod
61
- def from_json(cls, json_str: str) -> Speeds:
65
+ def from_json(cls, json_str: str) -> Optional[Self]:
62
66
  """Create an instance of Speeds from a JSON string"""
63
67
  return cls.from_dict(json.loads(json_str))
64
68
 
65
- def to_dict(self):
66
- """Returns the dictionary representation of the model using alias"""
67
- _dict = self.dict(by_alias=True,
68
- exclude={
69
- "additional_properties"
70
- },
71
- exclude_none=True)
69
+ def to_dict(self) -> Dict[str, Any]:
70
+ """Return the dictionary representation of the model using alias.
71
+
72
+ This has the following differences from calling pydantic's
73
+ `self.model_dump(by_alias=True)`:
74
+
75
+ * `None` is only added to the output dict for nullable fields that
76
+ were set at model initialization. Other fields with value `None`
77
+ are ignored.
78
+ * Fields in `self.additional_properties` are added to the output dict.
79
+ """
80
+ excluded_fields: Set[str] = set([
81
+ "additional_properties",
82
+ ])
83
+
84
+ _dict = self.model_dump(
85
+ by_alias=True,
86
+ exclude=excluded_fields,
87
+ exclude_none=True,
88
+ )
72
89
  # puts key-value pairs in additional_properties in the top level
73
90
  if self.additional_properties is not None:
74
91
  for _key, _value in self.additional_properties.items():
@@ -77,15 +94,15 @@ class Speeds(BaseModel):
77
94
  return _dict
78
95
 
79
96
  @classmethod
80
- def from_dict(cls, obj: dict) -> Speeds:
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
98
  """Create an instance of Speeds from a dict"""
82
99
  if obj is None:
83
100
  return None
84
101
 
85
102
  if not isinstance(obj, dict):
86
- return Speeds.parse_obj(obj)
103
+ return cls.model_validate(obj)
87
104
 
88
- _obj = Speeds.parse_obj({
105
+ _obj = cls.model_validate({
89
106
  "predicted": obj.get("predicted"),
90
107
  "constrained_flow": obj.get("constrained_flow"),
91
108
  "free_flow": obj.get("free_flow"),
@@ -99,3 +116,4 @@ class Speeds(BaseModel):
99
116
 
100
117
  return _obj
101
118
 
119
+