stadiamaps 1.0.6__py3-none-any.whl → 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) 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 +69 -48
  14. stadiamaps/models/auto_costing_options_all_of.py +1 -1
  15. stadiamaps/models/base_costing_options.py +52 -33
  16. stadiamaps/models/base_trace_request.py +70 -40
  17. stadiamaps/models/bicycle_costing_options.py +61 -42
  18. stadiamaps/models/bicycle_costing_options_all_of.py +1 -1
  19. stadiamaps/models/bike_network.py +42 -24
  20. stadiamaps/models/contour.py +45 -27
  21. stadiamaps/models/coordinate.py +45 -26
  22. stadiamaps/models/costing_model.py +10 -12
  23. stadiamaps/models/costing_options.py +51 -33
  24. stadiamaps/models/directions_options.py +45 -27
  25. stadiamaps/models/distance_unit.py +8 -11
  26. stadiamaps/models/edge_sign.py +46 -28
  27. stadiamaps/models/edge_use.py +8 -11
  28. stadiamaps/models/end_node.py +48 -30
  29. stadiamaps/models/geo_attributes.py +47 -29
  30. stadiamaps/models/geo_json_geometry.py +25 -25
  31. stadiamaps/models/geo_json_geometry_base.py +45 -27
  32. stadiamaps/models/geo_json_line_string.py +47 -28
  33. stadiamaps/models/geo_json_line_string_all_of.py +2 -2
  34. stadiamaps/models/geo_json_point.py +47 -28
  35. stadiamaps/models/geo_json_point_all_of.py +2 -2
  36. stadiamaps/models/geo_json_polygon.py +47 -28
  37. stadiamaps/models/geo_json_polygon_all_of.py +2 -2
  38. stadiamaps/models/geocoding_object.py +46 -28
  39. stadiamaps/models/height_request.py +55 -34
  40. stadiamaps/models/height_response.py +49 -30
  41. stadiamaps/models/highway_classification.py +52 -34
  42. stadiamaps/models/intersecting_edge.py +45 -27
  43. stadiamaps/models/isochrone_costing_model.py +8 -11
  44. stadiamaps/models/isochrone_feature.py +45 -27
  45. stadiamaps/models/isochrone_properties.py +48 -30
  46. stadiamaps/models/isochrone_request.py +54 -35
  47. stadiamaps/models/isochrone_response.py +47 -29
  48. stadiamaps/models/locate_detailed_edge.py +73 -55
  49. stadiamaps/models/locate_edge.py +56 -39
  50. stadiamaps/models/locate_edge_info.py +47 -29
  51. stadiamaps/models/locate_node.py +50 -31
  52. stadiamaps/models/locate_node_all_of.py +1 -1
  53. stadiamaps/models/locate_object.py +49 -31
  54. stadiamaps/models/maneuver_sign.py +50 -32
  55. stadiamaps/models/maneuver_sign_element.py +45 -27
  56. stadiamaps/models/map_match_costing_model.py +8 -11
  57. stadiamaps/models/map_match_request.py +74 -44
  58. stadiamaps/models/map_match_request_all_of.py +1 -1
  59. stadiamaps/models/map_match_route_response.py +57 -29
  60. stadiamaps/models/map_match_route_response_all_of.py +1 -1
  61. stadiamaps/models/map_match_trace_options.py +47 -29
  62. stadiamaps/models/map_match_waypoint.py +49 -30
  63. stadiamaps/models/map_match_waypoint_all_of.py +1 -1
  64. stadiamaps/models/matched_point.py +52 -34
  65. stadiamaps/models/matrix_costing_model.py +9 -12
  66. stadiamaps/models/matrix_distance.py +46 -28
  67. stadiamaps/models/matrix_request.py +70 -39
  68. stadiamaps/models/matrix_response.py +60 -36
  69. stadiamaps/models/motor_scooter_costing_options.py +70 -49
  70. stadiamaps/models/motor_scooter_costing_options_all_of.py +1 -1
  71. stadiamaps/models/motorcycle_costing_options.py +69 -48
  72. stadiamaps/models/motorcycle_costing_options_all_of.py +1 -1
  73. stadiamaps/models/nearest_roads_request.py +65 -34
  74. stadiamaps/models/node_id.py +42 -24
  75. stadiamaps/models/node_type.py +8 -11
  76. stadiamaps/models/optimized_route_request.py +66 -35
  77. stadiamaps/models/pedestrian_costing_options.py +59 -40
  78. stadiamaps/models/pelias_geo_json_feature.py +50 -31
  79. stadiamaps/models/pelias_geo_json_properties.py +54 -36
  80. stadiamaps/models/pelias_geo_json_properties_addendum.py +43 -25
  81. stadiamaps/models/pelias_geo_json_properties_addendum_osm.py +42 -24
  82. stadiamaps/models/pelias_layer.py +8 -11
  83. stadiamaps/models/pelias_response.py +49 -30
  84. stadiamaps/models/pelias_response_geocoding.py +1 -1
  85. stadiamaps/models/pelias_source.py +8 -11
  86. stadiamaps/models/restrictions.py +44 -26
  87. stadiamaps/models/road_class.py +8 -11
  88. stadiamaps/models/route_leg.py +48 -29
  89. stadiamaps/models/route_maneuver.py +73 -55
  90. stadiamaps/models/route_request.py +76 -43
  91. stadiamaps/models/route_response.py +56 -28
  92. stadiamaps/models/route_response_alternates_inner.py +105 -0
  93. stadiamaps/models/route_response_trip.py +1 -1
  94. stadiamaps/models/route_summary.py +48 -30
  95. stadiamaps/models/route_trip.py +135 -0
  96. stadiamaps/models/routing_response_waypoint.py +49 -30
  97. stadiamaps/models/routing_response_waypoint_all_of.py +1 -1
  98. stadiamaps/models/routing_waypoint.py +60 -41
  99. stadiamaps/models/routing_waypoint_all_of.py +1 -1
  100. stadiamaps/models/routing_waypoint_all_of_search_filter.py +48 -30
  101. stadiamaps/models/simple_routing_waypoint.py +48 -29
  102. stadiamaps/models/simple_routing_waypoint_all_of.py +1 -1
  103. stadiamaps/models/speeds.py +49 -31
  104. stadiamaps/models/trace_attribute_filter_options.py +47 -28
  105. stadiamaps/models/trace_attribute_key.py +8 -11
  106. stadiamaps/models/trace_attributes_base_response.py +51 -32
  107. stadiamaps/models/trace_attributes_request.py +72 -42
  108. stadiamaps/models/trace_attributes_request_all_of.py +1 -1
  109. stadiamaps/models/trace_attributes_request_all_of_filters.py +2 -2
  110. stadiamaps/models/trace_attributes_response.py +54 -35
  111. stadiamaps/models/trace_attributes_response_all_of.py +1 -1
  112. stadiamaps/models/trace_edge.py +88 -70
  113. stadiamaps/models/travel_mode.py +8 -11
  114. stadiamaps/models/traversability.py +8 -11
  115. stadiamaps/models/truck_costing_options.py +72 -51
  116. stadiamaps/models/truck_costing_options_all_of.py +1 -1
  117. stadiamaps/models/tz_response.py +45 -27
  118. stadiamaps/models/valhalla_languages.py +8 -11
  119. stadiamaps/models/valhalla_long_units.py +8 -11
  120. stadiamaps/models/warning.py +42 -24
  121. stadiamaps/py.typed +0 -0
  122. stadiamaps/rest.py +127 -172
  123. {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/METADATA +4 -4
  124. stadiamaps-2.0.0.dist-info/RECORD +128 -0
  125. {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/WHEEL +1 -1
  126. stadiamaps-1.0.6.dist-info/RECORD +0 -125
  127. {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/LICENSE.txt +0 -0
  128. {stadiamaps-1.0.6.dist-info → stadiamaps-2.0.0.dist-info}/top_level.txt +0 -0
@@ -3,14 +3,14 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # 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.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,63 +18,93 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import List, Optional
23
- from pydantic import BaseModel, Field, StrictStr, conlist, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.costing_options import CostingOptions
25
- from stadiamaps.models.directions_options import DirectionsOptions
24
+ from stadiamaps.models.distance_unit import DistanceUnit
26
25
  from stadiamaps.models.map_match_costing_model import MapMatchCostingModel
27
26
  from stadiamaps.models.map_match_waypoint import MapMatchWaypoint
27
+ from stadiamaps.models.valhalla_languages import ValhallaLanguages
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
28
30
 
29
31
  class BaseTraceRequest(BaseModel):
30
32
  """
31
33
  BaseTraceRequest
32
- """
33
- id: Optional[StrictStr] = Field(None, description="An identifier to disambiguate requests (echoed by the server).")
34
- shape: Optional[conlist(MapMatchWaypoint)] = Field(None, description="REQUIRED if `encoded_polyline` is not present. Note that `break` type locations are only supported when `shape_match` is set to `map_match`.")
35
- encoded_polyline: Optional[StrictStr] = Field(None, description="REQUIRED if `shape` is not present. An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline must be encoded with 6 digits of precision rather than the usual 5.")
36
- costing: MapMatchCostingModel = Field(...)
34
+ """ # noqa: E501
35
+ units: Optional[DistanceUnit] = None
36
+ language: Optional[ValhallaLanguages] = None
37
+ directions_type: Optional[StrictStr] = Field(default='instructions', description="The level of directional narrative to include. Locations and times will always be returned, but narrative generation verbosity can be controlled with this parameter.")
38
+ id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
39
+ shape: Optional[List[MapMatchWaypoint]] = Field(default=None, description="REQUIRED if `encoded_polyline` is not present. Note that `break` type locations are only supported when `shape_match` is set to `map_match`.")
40
+ encoded_polyline: Optional[StrictStr] = Field(default=None, description="REQUIRED if `shape` is not present. An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline must be encoded with 6 digits of precision rather than the usual 5.")
41
+ costing: MapMatchCostingModel
37
42
  costing_options: Optional[CostingOptions] = None
38
- shape_match: Optional[StrictStr] = Field(None, description="Three snapping modes provide some control over how the map matching occurs. `edge_walk` is fast, but requires extremely precise data that matches the route graph almost perfectly. `map_snap` can handle significantly noisier data, but is very expensive. `walk_or_snap`, the default, tries to use edge walking first and falls back to map matching if edge walking fails. In general, you should not need to change this parameter unless you want to trace a multi-leg route with multiple `break` locations in the `shape`.")
39
- directions_options: Optional[DirectionsOptions] = None
43
+ shape_match: Optional[StrictStr] = Field(default=None, description="Three snapping modes provide some control over how the map matching occurs. `edge_walk` is fast, but requires extremely precise data that matches the route graph almost perfectly. `map_snap` can handle significantly noisier data, but is very expensive. `walk_or_snap`, the default, tries to use edge walking first and falls back to map matching if edge walking fails. In general, you should not need to change this parameter unless you want to trace a multi-leg route with multiple `break` locations in the `shape`.")
40
44
  additional_properties: Dict[str, Any] = {}
41
- __properties = ["id", "shape", "encoded_polyline", "costing", "costing_options", "shape_match", "directions_options"]
45
+ __properties: ClassVar[List[str]] = ["units", "language", "directions_type", "id", "shape", "encoded_polyline", "costing", "costing_options", "shape_match"]
42
46
 
43
- @validator('shape_match')
47
+ @field_validator('directions_type')
48
+ def directions_type_validate_enum(cls, value):
49
+ """Validates the enum"""
50
+ if value is None:
51
+ return value
52
+
53
+ if value not in set(['none', 'maneuvers', 'instructions']):
54
+ raise ValueError("must be one of enum values ('none', 'maneuvers', 'instructions')")
55
+ return value
56
+
57
+ @field_validator('shape_match')
44
58
  def shape_match_validate_enum(cls, value):
45
59
  """Validates the enum"""
46
60
  if value is None:
47
61
  return value
48
62
 
49
- if value not in ('edge_walk', 'map_snap', 'walk_or_snap'):
63
+ if value not in set(['edge_walk', 'map_snap', 'walk_or_snap']):
50
64
  raise ValueError("must be one of enum values ('edge_walk', 'map_snap', 'walk_or_snap')")
51
65
  return value
52
66
 
53
- class Config:
54
- """Pydantic configuration"""
55
- allow_population_by_field_name = True
56
- validate_assignment = True
67
+ model_config = ConfigDict(
68
+ populate_by_name=True,
69
+ validate_assignment=True,
70
+ protected_namespaces=(),
71
+ )
72
+
57
73
 
58
74
  def to_str(self) -> str:
59
75
  """Returns the string representation of the model using alias"""
60
- return pprint.pformat(self.dict(by_alias=True))
76
+ return pprint.pformat(self.model_dump(by_alias=True))
61
77
 
62
78
  def to_json(self) -> str:
63
79
  """Returns the JSON representation of the model using alias"""
80
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
81
  return json.dumps(self.to_dict())
65
82
 
66
83
  @classmethod
67
- def from_json(cls, json_str: str) -> BaseTraceRequest:
84
+ def from_json(cls, json_str: str) -> Optional[Self]:
68
85
  """Create an instance of BaseTraceRequest from a JSON string"""
69
86
  return cls.from_dict(json.loads(json_str))
70
87
 
71
- def to_dict(self):
72
- """Returns the dictionary representation of the model using alias"""
73
- _dict = self.dict(by_alias=True,
74
- exclude={
75
- "additional_properties"
76
- },
77
- exclude_none=True)
88
+ def to_dict(self) -> Dict[str, Any]:
89
+ """Return the dictionary representation of the model using alias.
90
+
91
+ This has the following differences from calling pydantic's
92
+ `self.model_dump(by_alias=True)`:
93
+
94
+ * `None` is only added to the output dict for nullable fields that
95
+ were set at model initialization. Other fields with value `None`
96
+ are ignored.
97
+ * Fields in `self.additional_properties` are added to the output dict.
98
+ """
99
+ excluded_fields: Set[str] = set([
100
+ "additional_properties",
101
+ ])
102
+
103
+ _dict = self.model_dump(
104
+ by_alias=True,
105
+ exclude=excluded_fields,
106
+ exclude_none=True,
107
+ )
78
108
  # override the default output from pydantic by calling `to_dict()` of each item in shape (list)
79
109
  _items = []
80
110
  if self.shape:
@@ -85,9 +115,6 @@ class BaseTraceRequest(BaseModel):
85
115
  # override the default output from pydantic by calling `to_dict()` of costing_options
86
116
  if self.costing_options:
87
117
  _dict['costing_options'] = self.costing_options.to_dict()
88
- # override the default output from pydantic by calling `to_dict()` of directions_options
89
- if self.directions_options:
90
- _dict['directions_options'] = self.directions_options.to_dict()
91
118
  # puts key-value pairs in additional_properties in the top level
92
119
  if self.additional_properties is not None:
93
120
  for _key, _value in self.additional_properties.items():
@@ -96,22 +123,24 @@ class BaseTraceRequest(BaseModel):
96
123
  return _dict
97
124
 
98
125
  @classmethod
99
- def from_dict(cls, obj: dict) -> BaseTraceRequest:
126
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
127
  """Create an instance of BaseTraceRequest from a dict"""
101
128
  if obj is None:
102
129
  return None
103
130
 
104
131
  if not isinstance(obj, dict):
105
- return BaseTraceRequest.parse_obj(obj)
132
+ return cls.model_validate(obj)
106
133
 
107
- _obj = BaseTraceRequest.parse_obj({
134
+ _obj = cls.model_validate({
135
+ "units": obj.get("units"),
136
+ "language": obj.get("language"),
137
+ "directions_type": obj.get("directions_type") if obj.get("directions_type") is not None else 'instructions',
108
138
  "id": obj.get("id"),
109
- "shape": [MapMatchWaypoint.from_dict(_item) for _item in obj.get("shape")] if obj.get("shape") is not None else None,
139
+ "shape": [MapMatchWaypoint.from_dict(_item) for _item in obj["shape"]] if obj.get("shape") is not None else None,
110
140
  "encoded_polyline": obj.get("encoded_polyline"),
111
141
  "costing": obj.get("costing"),
112
- "costing_options": CostingOptions.from_dict(obj.get("costing_options")) if obj.get("costing_options") is not None else None,
113
- "shape_match": obj.get("shape_match"),
114
- "directions_options": DirectionsOptions.from_dict(obj.get("directions_options")) if obj.get("directions_options") is not None else None
142
+ "costing_options": CostingOptions.from_dict(obj["costing_options"]) if obj.get("costing_options") is not None else None,
143
+ "shape_match": obj.get("shape_match")
115
144
  })
116
145
  # store additional fields in additional_properties
117
146
  for _key in obj.keys():
@@ -120,3 +149,4 @@ class BaseTraceRequest(BaseModel):
120
149
 
121
150
  return _obj
122
151
 
152
+
@@ -3,14 +3,14 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # 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.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,68 +18,86 @@ 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, confloat, conint, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing_extensions import Annotated
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
24
26
 
25
27
  class BicycleCostingOptions(BaseModel):
26
28
  """
27
29
  BicycleCostingOptions
28
- """
29
- maneuver_penalty: Optional[StrictInt] = Field(5, description="A penalty (in seconds) applied when transitioning between roads (determined by name).")
30
- gate_cost: Optional[StrictInt] = Field(15, description="The estimated cost (in seconds) when a gate is encountered.")
31
- gate_penalty: Optional[StrictInt] = Field(300, description="A penalty (in seconds) applied to the route cost when a gate is encountered. This penalty can be used to reduce the likelihood of suggesting a route with gates unless absolutely necessary.")
32
- country_crossing_cost: Optional[StrictInt] = Field(600, description="The estimated cost (in seconds) when encountering an international border.")
33
- country_crossing_penalty: Optional[StrictInt] = Field(0, description="A penalty applied to transitions to international border crossings. This penalty can be used to reduce the likelihood of suggesting a route with border crossings unless absolutely necessary.")
34
- service_penalty: Optional[StrictInt] = Field(None, description="A penalty applied to transitions to service roads. This penalty can be used to reduce the likelihood of suggesting a route with service roads unless absolutely necessary. The default penalty is 15 for cars, busses, motor scooters, and motorcycles; and zero for others.")
35
- service_factor: Optional[Union[StrictFloat, StrictInt]] = Field(1, description="A factor that multiplies the cost when service roads are encountered. The default is 1.2 for cars and busses, and 1 for trucks, motor scooters, and motorcycles.")
36
- use_living_streets: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = Field(None, description="A measure of willingness to take living streets. Values near 0 attempt to avoid them, and values near 1 will favour them. Note that as some routes may be impossible without living streets, 0 does not guarantee avoidance of them. The default value is 0 for trucks; 0.1 for other motor vehicles; 0.5 for bicycles; and 0.6 for pedestrians.")
37
- use_ferry: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = Field(0.5, description="A measure of willingness to take ferries. Values near 0 attempt to avoid ferries, and values near 1 will favour them. Note that as some routes may be impossible without ferries, 0 does not guarantee avoidance of them.")
38
- bicycle_type: Optional[StrictStr] = 'Hybrid'
39
- cycling_speed: Optional[StrictInt] = Field(None, description="The average comfortable travel speed (in kph) along smooth, flat roads. The costing will vary the speed based on the surface, bicycle type, elevation change, etc. This value should be the average sustainable cruising speed the cyclist can maintain over the entire route. The default speeds are as follows based on bicycle type: * Road - 25kph * Cross - 20kph * Hybrid - 18kph * Mountain - 16kph")
40
- use_roads: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = Field(0.5, description="A measure of willingness to use roads alongside other vehicles. Values near 0 attempt to avoid roads and stay on cycleways, and values near 1 indicate the cyclist is more comfortable on roads.")
41
- use_hills: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = Field(0.5, description="A measure of willingness to take tackle hills. Values near 0 attempt to avoid hills and steeper grades even if it means a longer route, and values near 1 indicates that the user does not fear them. Note that as some routes may be impossible without hills, 0 does not guarantee avoidance of them.")
42
- avoid_bad_surfaces: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = Field(0.25, description="A measure of how much the cyclist wants to avoid roads with poor surfaces relative to the type of bicycle being ridden. When 0, there is no penalization of roads with poorer surfaces, and only bicycle speed is taken into account. As the value approaches 1, roads with poor surfaces relative to the bicycle type receive a heaver penalty, so they will only be taken if they significantly reduce travel time. When the value is 1, all bad surfaces are completely avoided from the route, including the start and end points.")
43
- bss_return_cost: Optional[StrictInt] = Field(120, description="The estimated cost (in seconds) to return a bicycle in `bikeshare` mode.")
44
- bss_return_penalty: Optional[StrictInt] = Field(0, description="A penalty (in seconds) to return a bicycle in `bikeshare` mode.")
30
+ """ # noqa: E501
31
+ maneuver_penalty: Optional[StrictInt] = Field(default=5, description="A penalty (in seconds) applied when transitioning between roads (determined by name).")
32
+ gate_cost: Optional[StrictInt] = Field(default=15, description="The estimated cost (in seconds) when a gate is encountered.")
33
+ gate_penalty: Optional[StrictInt] = Field(default=300, description="A penalty (in seconds) applied to the route cost when a gate is encountered. This penalty can be used to reduce the likelihood of suggesting a route with gates unless absolutely necessary.")
34
+ country_crossing_cost: Optional[StrictInt] = Field(default=600, description="The estimated cost (in seconds) when encountering an international border.")
35
+ country_crossing_penalty: Optional[StrictInt] = Field(default=0, description="A penalty applied to transitions to international border crossings. This penalty can be used to reduce the likelihood of suggesting a route with border crossings unless absolutely necessary.")
36
+ service_penalty: Optional[StrictInt] = Field(default=None, description="A penalty applied to transitions to service roads. This penalty can be used to reduce the likelihood of suggesting a route with service roads unless absolutely necessary. The default penalty is 15 for cars, busses, motor scooters, and motorcycles; and zero for others.")
37
+ service_factor: Optional[Union[StrictFloat, StrictInt]] = Field(default=1, description="A factor that multiplies the cost when service roads are encountered. The default is 1.2 for cars and busses, and 1 for trucks, motor scooters, and motorcycles.")
38
+ use_living_streets: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=None, description="A measure of willingness to take living streets. Values near 0 attempt to avoid them, and values near 1 will favour them. Note that as some routes may be impossible without living streets, 0 does not guarantee avoidance of them. The default value is 0 for trucks; 0.1 for other motor vehicles; 0.5 for bicycles; and 0.6 for pedestrians.")
39
+ use_ferry: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0.5, description="A measure of willingness to take ferries. Values near 0 attempt to avoid ferries, and values near 1 will favour them. Note that as some routes may be impossible without ferries, 0 does not guarantee avoidance of them.")
40
+ bicycle_type: Optional[StrictStr] = Field(default='Hybrid', description="The type of bicycle: * Road: has narrow tires and is generally lightweight and designed for speed on paved surfaces * Hybrid or City: designed for city riding or casual riding on roads and paths with good surfaces * Cross: similar to a road bike, but has wider tires so it can handle rougher surfaces * Mountain: able to handle most surfaces, but generally heavier and slower on paved surfaces")
41
+ cycling_speed: Optional[StrictInt] = Field(default=None, description="The average comfortable travel speed (in kph) along smooth, flat roads. The costing will vary the speed based on the surface, bicycle type, elevation change, etc. This value should be the average sustainable cruising speed the cyclist can maintain over the entire route. The default speeds are as follows based on bicycle type: * Road - 25kph * Cross - 20kph * Hybrid - 18kph * Mountain - 16kph")
42
+ use_roads: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0.5, description="A measure of willingness to use roads alongside other vehicles. Values near 0 attempt to avoid roads and stay on cycleways, and values near 1 indicate the cyclist is more comfortable on roads.")
43
+ use_hills: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0.5, description="A measure of willingness to take tackle hills. Values near 0 attempt to avoid hills and steeper grades even if it means a longer route, and values near 1 indicates that the user does not fear them. Note that as some routes may be impossible without hills, 0 does not guarantee avoidance of them.")
44
+ avoid_bad_surfaces: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0.25, description="A measure of how much the cyclist wants to avoid roads with poor surfaces relative to the type of bicycle being ridden. When 0, there is no penalization of roads with poorer surfaces, and only bicycle speed is taken into account. As the value approaches 1, roads with poor surfaces relative to the bicycle type receive a heaver penalty, so they will only be taken if they significantly reduce travel time. When the value is 1, all bad surfaces are completely avoided from the route, including the start and end points.")
45
+ bss_return_cost: Optional[StrictInt] = Field(default=120, description="The estimated cost (in seconds) to return a bicycle in `bikeshare` mode.")
46
+ bss_return_penalty: Optional[StrictInt] = Field(default=0, description="A penalty (in seconds) to return a bicycle in `bikeshare` mode.")
45
47
  additional_properties: Dict[str, Any] = {}
46
- __properties = ["maneuver_penalty", "gate_cost", "gate_penalty", "country_crossing_cost", "country_crossing_penalty", "service_penalty", "service_factor", "use_living_streets", "use_ferry", "bicycle_type", "cycling_speed", "use_roads", "use_hills", "avoid_bad_surfaces", "bss_return_cost", "bss_return_penalty"]
48
+ __properties: ClassVar[List[str]] = ["maneuver_penalty", "gate_cost", "gate_penalty", "country_crossing_cost", "country_crossing_penalty", "service_penalty", "service_factor", "use_living_streets", "use_ferry", "bicycle_type", "cycling_speed", "use_roads", "use_hills", "avoid_bad_surfaces", "bss_return_cost", "bss_return_penalty"]
47
49
 
48
- @validator('bicycle_type')
50
+ @field_validator('bicycle_type')
49
51
  def bicycle_type_validate_enum(cls, value):
50
52
  """Validates the enum"""
51
53
  if value is None:
52
54
  return value
53
55
 
54
- if value not in ('Road', 'Hybrid', 'Cross', 'Mountain'):
56
+ if value not in set(['Road', 'Hybrid', 'Cross', 'Mountain']):
55
57
  raise ValueError("must be one of enum values ('Road', 'Hybrid', 'Cross', 'Mountain')")
56
58
  return value
57
59
 
58
- class Config:
59
- """Pydantic configuration"""
60
- allow_population_by_field_name = True
61
- validate_assignment = True
60
+ model_config = ConfigDict(
61
+ populate_by_name=True,
62
+ validate_assignment=True,
63
+ protected_namespaces=(),
64
+ )
65
+
62
66
 
63
67
  def to_str(self) -> str:
64
68
  """Returns the string representation of the model using alias"""
65
- return pprint.pformat(self.dict(by_alias=True))
69
+ return pprint.pformat(self.model_dump(by_alias=True))
66
70
 
67
71
  def to_json(self) -> str:
68
72
  """Returns the JSON representation of the model using alias"""
73
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
74
  return json.dumps(self.to_dict())
70
75
 
71
76
  @classmethod
72
- def from_json(cls, json_str: str) -> BicycleCostingOptions:
77
+ def from_json(cls, json_str: str) -> Optional[Self]:
73
78
  """Create an instance of BicycleCostingOptions from a JSON string"""
74
79
  return cls.from_dict(json.loads(json_str))
75
80
 
76
- def to_dict(self):
77
- """Returns the dictionary representation of the model using alias"""
78
- _dict = self.dict(by_alias=True,
79
- exclude={
80
- "additional_properties"
81
- },
82
- exclude_none=True)
81
+ def to_dict(self) -> Dict[str, Any]:
82
+ """Return the dictionary representation of the model using alias.
83
+
84
+ This has the following differences from calling pydantic's
85
+ `self.model_dump(by_alias=True)`:
86
+
87
+ * `None` is only added to the output dict for nullable fields that
88
+ were set at model initialization. Other fields with value `None`
89
+ are ignored.
90
+ * Fields in `self.additional_properties` are added to the output dict.
91
+ """
92
+ excluded_fields: Set[str] = set([
93
+ "additional_properties",
94
+ ])
95
+
96
+ _dict = self.model_dump(
97
+ by_alias=True,
98
+ exclude=excluded_fields,
99
+ exclude_none=True,
100
+ )
83
101
  # puts key-value pairs in additional_properties in the top level
84
102
  if self.additional_properties is not None:
85
103
  for _key, _value in self.additional_properties.items():
@@ -88,15 +106,15 @@ class BicycleCostingOptions(BaseModel):
88
106
  return _dict
89
107
 
90
108
  @classmethod
91
- def from_dict(cls, obj: dict) -> BicycleCostingOptions:
109
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
110
  """Create an instance of BicycleCostingOptions from a dict"""
93
111
  if obj is None:
94
112
  return None
95
113
 
96
114
  if not isinstance(obj, dict):
97
- return BicycleCostingOptions.parse_obj(obj)
115
+ return cls.model_validate(obj)
98
116
 
99
- _obj = BicycleCostingOptions.parse_obj({
117
+ _obj = cls.model_validate({
100
118
  "maneuver_penalty": obj.get("maneuver_penalty") if obj.get("maneuver_penalty") is not None else 5,
101
119
  "gate_cost": obj.get("gate_cost") if obj.get("gate_cost") is not None else 15,
102
120
  "gate_penalty": obj.get("gate_penalty") if obj.get("gate_penalty") is not None else 300,
@@ -121,3 +139,4 @@ class BicycleCostingOptions(BaseModel):
121
139
 
122
140
  return _obj
123
141
 
142
+
@@ -5,7 +5,7 @@
5
5
 
6
6
  The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
7
7
 
8
- The version of the OpenAPI document: 5.0.5
8
+ The version of the OpenAPI document: 5.0.6
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
@@ -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.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,46 +18,63 @@ 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, StrictBool
21
+ from pydantic import BaseModel, ConfigDict, StrictBool
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 BikeNetwork(BaseModel):
26
27
  """
27
28
  BikeNetwork
28
- """
29
+ """ # noqa: E501
29
30
  mountain: Optional[StrictBool] = None
30
31
  local: Optional[StrictBool] = None
31
32
  regional: Optional[StrictBool] = None
32
33
  national: Optional[StrictBool] = None
33
34
  additional_properties: Dict[str, Any] = {}
34
- __properties = ["mountain", "local", "regional", "national"]
35
+ __properties: ClassVar[List[str]] = ["mountain", "local", "regional", "national"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
35
42
 
36
- class Config:
37
- """Pydantic configuration"""
38
- allow_population_by_field_name = True
39
- validate_assignment = True
40
43
 
41
44
  def to_str(self) -> str:
42
45
  """Returns the string representation of the model using alias"""
43
- return pprint.pformat(self.dict(by_alias=True))
46
+ return pprint.pformat(self.model_dump(by_alias=True))
44
47
 
45
48
  def to_json(self) -> str:
46
49
  """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
51
  return json.dumps(self.to_dict())
48
52
 
49
53
  @classmethod
50
- def from_json(cls, json_str: str) -> BikeNetwork:
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
55
  """Create an instance of BikeNetwork from a JSON string"""
52
56
  return cls.from_dict(json.loads(json_str))
53
57
 
54
- def to_dict(self):
55
- """Returns the dictionary representation of the model using alias"""
56
- _dict = self.dict(by_alias=True,
57
- exclude={
58
- "additional_properties"
59
- },
60
- exclude_none=True)
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ * Fields in `self.additional_properties` are added to the output dict.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ "additional_properties",
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
61
78
  # puts key-value pairs in additional_properties in the top level
62
79
  if self.additional_properties is not None:
63
80
  for _key, _value in self.additional_properties.items():
@@ -66,15 +83,15 @@ class BikeNetwork(BaseModel):
66
83
  return _dict
67
84
 
68
85
  @classmethod
69
- def from_dict(cls, obj: dict) -> BikeNetwork:
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
70
87
  """Create an instance of BikeNetwork from a dict"""
71
88
  if obj is None:
72
89
  return None
73
90
 
74
91
  if not isinstance(obj, dict):
75
- return BikeNetwork.parse_obj(obj)
92
+ return cls.model_validate(obj)
76
93
 
77
- _obj = BikeNetwork.parse_obj({
94
+ _obj = cls.model_validate({
78
95
  "mountain": obj.get("mountain"),
79
96
  "local": obj.get("local"),
80
97
  "regional": obj.get("regional"),
@@ -87,3 +104,4 @@ class BikeNetwork(BaseModel):
87
104
 
88
105
  return _obj
89
106
 
107
+
@@ -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.5
8
+ The version of the OpenAPI document: 6.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,45 +18,62 @@ 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
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
24
25
 
25
26
  class Contour(BaseModel):
26
27
  """
27
28
  Contour
28
- """
29
- time: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The time in minutes for the contour. Mutually exclusive of distance.")
30
- distance: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The distance in km for the contour. Mutually exclusive of time.")
31
- color: Optional[StrictStr] = Field(None, description="The color for the output contour, specified as a hex value (without a leading `#`). If no color is specified, one will be assigned automatically.")
29
+ """ # noqa: E501
30
+ time: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The time in minutes for the contour. Mutually exclusive of distance.")
31
+ distance: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The distance in km for the contour. Mutually exclusive of time.")
32
+ color: Optional[StrictStr] = Field(default=None, description="The color for the output contour, specified as a hex value (without a leading `#`). If no color is specified, one will be assigned automatically.")
32
33
  additional_properties: Dict[str, Any] = {}
33
- __properties = ["time", "distance", "color"]
34
+ __properties: ClassVar[List[str]] = ["time", "distance", "color"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
34
41
 
35
- class Config:
36
- """Pydantic configuration"""
37
- allow_population_by_field_name = True
38
- validate_assignment = True
39
42
 
40
43
  def to_str(self) -> str:
41
44
  """Returns the string representation of the model using alias"""
42
- return pprint.pformat(self.dict(by_alias=True))
45
+ return pprint.pformat(self.model_dump(by_alias=True))
43
46
 
44
47
  def to_json(self) -> str:
45
48
  """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
50
  return json.dumps(self.to_dict())
47
51
 
48
52
  @classmethod
49
- def from_json(cls, json_str: str) -> Contour:
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
54
  """Create an instance of Contour from a JSON string"""
51
55
  return cls.from_dict(json.loads(json_str))
52
56
 
53
- def to_dict(self):
54
- """Returns the dictionary representation of the model using alias"""
55
- _dict = self.dict(by_alias=True,
56
- exclude={
57
- "additional_properties"
58
- },
59
- exclude_none=True)
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ * Fields in `self.additional_properties` are added to the output dict.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ "additional_properties",
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
60
77
  # puts key-value pairs in additional_properties in the top level
61
78
  if self.additional_properties is not None:
62
79
  for _key, _value in self.additional_properties.items():
@@ -65,15 +82,15 @@ class Contour(BaseModel):
65
82
  return _dict
66
83
 
67
84
  @classmethod
68
- def from_dict(cls, obj: dict) -> Contour:
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
69
86
  """Create an instance of Contour from a dict"""
70
87
  if obj is None:
71
88
  return None
72
89
 
73
90
  if not isinstance(obj, dict):
74
- return Contour.parse_obj(obj)
91
+ return cls.model_validate(obj)
75
92
 
76
- _obj = Contour.parse_obj({
93
+ _obj = cls.model_validate({
77
94
  "time": obj.get("time"),
78
95
  "distance": obj.get("distance"),
79
96
  "color": obj.get("color")
@@ -85,3 +102,4 @@ class Contour(BaseModel):
85
102
 
86
103
  return _obj
87
104
 
105
+