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,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, Field, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
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 Administrative(BaseModel):
26
27
  """
27
28
  Administrative
28
- """
29
- iso_3166_1: Optional[StrictStr] = Field(None, alias="iso_3166-1", description="The ISO 3166-1 alpha-2 country code of the administrative region.")
30
- country: Optional[StrictStr] = Field(None, description="The full country name.")
31
- iso_3166_2: Optional[StrictStr] = Field(None, alias="iso_3166-2", description="The ISO 3166-2 code identifying the principal subdivision (ex: provinces or states) within a country.")
32
- state: Optional[StrictStr] = Field(None, description="The full state or province name.")
29
+ """ # noqa: E501
30
+ iso_3166_1: Optional[StrictStr] = Field(default=None, description="The ISO 3166-1 alpha-2 country code of the administrative region.", alias="iso_3166-1")
31
+ country: Optional[StrictStr] = Field(default=None, description="The full country name.")
32
+ iso_3166_2: Optional[StrictStr] = Field(default=None, description="The ISO 3166-2 code identifying the principal subdivision (ex: provinces or states) within a country.", alias="iso_3166-2")
33
+ state: Optional[StrictStr] = Field(default=None, description="The full state or province name.")
33
34
  additional_properties: Dict[str, Any] = {}
34
- __properties = ["iso_3166-1", "country", "iso_3166-2", "state"]
35
+ __properties: ClassVar[List[str]] = ["iso_3166-1", "country", "iso_3166-2", "state"]
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) -> Administrative:
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
55
  """Create an instance of Administrative 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,18 +83,18 @@ class Administrative(BaseModel):
66
83
  return _dict
67
84
 
68
85
  @classmethod
69
- def from_dict(cls, obj: dict) -> Administrative:
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
70
87
  """Create an instance of Administrative from a dict"""
71
88
  if obj is None:
72
89
  return None
73
90
 
74
91
  if not isinstance(obj, dict):
75
- return Administrative.parse_obj(obj)
92
+ return cls.model_validate(obj)
76
93
 
77
- _obj = Administrative.parse_obj({
78
- "iso_3166_1": obj.get("iso_3166-1"),
94
+ _obj = cls.model_validate({
95
+ "iso_3166-1": obj.get("iso_3166-1"),
79
96
  "country": obj.get("country"),
80
- "iso_3166_2": obj.get("iso_3166-2"),
97
+ "iso_3166-2": obj.get("iso_3166-2"),
81
98
  "state": obj.get("state")
82
99
  })
83
100
  # store additional fields in additional_properties
@@ -87,3 +104,4 @@ class Administrative(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.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,65 +18,87 @@ 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, confloat, conint
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt
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 AutoCostingOptions(BaseModel):
26
28
  """
27
29
  AutoCostingOptions
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
- height: Optional[Union[StrictFloat, StrictInt]] = Field(1.9, description="The height of the automobile (in meters).")
39
- width: Optional[Union[StrictFloat, StrictInt]] = Field(1.6, description="The width of the automobile (in meters).")
40
- toll_booth_cost: Optional[StrictInt] = Field(15, description="The estimated cost (in seconds) when a toll booth is encountered.")
41
- toll_booth_penalty: Optional[StrictInt] = Field(0, description="A penalty (in seconds) applied to the route cost when a toll booth is encountered. This penalty can be used to reduce the likelihood of suggesting a route with toll booths unless absolutely necessary.")
42
- ferry_cost: Optional[StrictInt] = Field(300, description="The estimated cost (in seconds) when a ferry is encountered.")
43
- use_highways: 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 highways. Values near 0 attempt to avoid highways, and values near 1 will favour them. Note that as some routes may be impossible without highways, 0 does not guarantee avoidance of them.")
44
- use_tolls: 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 toll roads. Values near 0 attempt to avoid tolls, and values near 1 will favour them. Note that as some routes may be impossible without tolls, 0 does not guarantee avoidance of them.")
45
- use_tracks: 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 track roads. Values near 0 attempt to avoid them, and values near 1 will favour them. Note that as some routes may be impossible without track roads, 0 does not guarantee avoidance of them. The default value is 0 for automobiles, busses, and trucks; and 0.5 for all other costing modes.")
46
- top_speed: Optional[conint(strict=True, le=252, ge=10)] = Field(140, description="The top speed (in kph) that the vehicle is capable of travelling.")
47
- shortest: Optional[StrictBool] = Field(False, description="If true changes the cost metric to be quasi-shortest (pure distance-based) costing. This will disable ALL other costing factors.")
48
- ignore_closures: Optional[StrictBool] = Field(False, description="If true, ignores all known closures. This option cannot be set if `location.search_filter.exclude_closures` is also specified.")
49
- include_hov2: Optional[StrictBool] = Field(False, description="If true, indicates the desire to include HOV roads with a 2-occupant requirement in the route when advantageous.")
50
- include_hov3: Optional[StrictBool] = Field(False, description="If true, indicates the desire to include HOV roads with a 3-occupant requirement in the route when advantageous.")
51
- include_hot: Optional[StrictBool] = Field(False, description="If true, indicates the desire to include toll roads which require the driver to pay a toll if the occupant requirement isn't met")
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
+ ignore_restrictions: Optional[StrictBool] = Field(default=None, description="If set to true, ignores any restrictions (eg: turn and conditional restrictions). Useful for matching GPS traces to the road network regardless of restrictions.")
41
+ ignore_non_vehicular_restrictions: Optional[StrictBool] = Field(default=None, description="If set to true, ignores most restrictions (eg: turn and conditional restrictions), but still respects restrictions that impact vehicle safety such as weight and size.")
42
+ ignore_oneways: Optional[StrictBool] = Field(default=None, description="If set to true, ignores directional restrictions on roads. Useful for matching GPS traces to the road network regardless of restrictions.")
43
+ height: Optional[Union[StrictFloat, StrictInt]] = Field(default=1.9, description="The height of the automobile (in meters).")
44
+ width: Optional[Union[StrictFloat, StrictInt]] = Field(default=1.6, description="The width of the automobile (in meters).")
45
+ toll_booth_cost: Optional[StrictInt] = Field(default=15, description="The estimated cost (in seconds) when a toll booth is encountered.")
46
+ toll_booth_penalty: Optional[StrictInt] = Field(default=0, description="A penalty (in seconds) applied to the route cost when a toll booth is encountered. This penalty can be used to reduce the likelihood of suggesting a route with toll booths unless absolutely necessary.")
47
+ ferry_cost: Optional[StrictInt] = Field(default=300, description="The estimated cost (in seconds) when a ferry is encountered.")
48
+ use_highways: 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 highways. Values near 0 attempt to avoid highways, and values near 1 will favour them. Note that as some routes may be impossible without highways, 0 does not guarantee avoidance of them.")
49
+ use_tolls: 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 toll roads. Values near 0 attempt to avoid tolls, and values near 1 will favour them. Note that as some routes may be impossible without tolls, 0 does not guarantee avoidance of them.")
50
+ use_tracks: 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 track roads. Values near 0 attempt to avoid them, and values near 1 will favour them. Note that as some routes may be impossible without track roads, 0 does not guarantee avoidance of them. The default value is 0 for automobiles, busses, and trucks; and 0.5 for all other costing modes.")
51
+ top_speed: Optional[Annotated[int, Field(le=252, strict=True, ge=10)]] = Field(default=140, description="The top speed (in kph) that the vehicle is capable of travelling.")
52
+ shortest: Optional[StrictBool] = Field(default=False, description="If true changes the cost metric to be quasi-shortest (pure distance-based) costing. This will disable ALL other costing factors.")
53
+ ignore_closures: Optional[StrictBool] = Field(default=False, description="If true, ignores all known closures. This option cannot be set if `location.search_filter.exclude_closures` is also specified.")
54
+ include_hov2: Optional[StrictBool] = Field(default=False, description="If true, indicates the desire to include HOV roads with a 2-occupant requirement in the route when advantageous.")
55
+ include_hov3: Optional[StrictBool] = Field(default=False, description="If true, indicates the desire to include HOV roads with a 3-occupant requirement in the route when advantageous.")
56
+ include_hot: Optional[StrictBool] = Field(default=False, description="If true, indicates the desire to include toll roads which require the driver to pay a toll if the occupant requirement isn't met")
57
+ alley_factor: Optional[Union[StrictFloat, StrictInt]] = Field(default=1, description="A factor that multiplies the cost when alleys are encountered.")
52
58
  additional_properties: Dict[str, Any] = {}
53
- __properties = ["maneuver_penalty", "gate_cost", "gate_penalty", "country_crossing_cost", "country_crossing_penalty", "service_penalty", "service_factor", "use_living_streets", "use_ferry", "height", "width", "toll_booth_cost", "toll_booth_penalty", "ferry_cost", "use_highways", "use_tolls", "use_tracks", "top_speed", "shortest", "ignore_closures", "include_hov2", "include_hov3", "include_hot"]
59
+ __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", "ignore_restrictions", "ignore_non_vehicular_restrictions", "ignore_oneways", "height", "width", "toll_booth_cost", "toll_booth_penalty", "ferry_cost", "use_highways", "use_tolls", "use_tracks", "top_speed", "shortest", "ignore_closures", "include_hov2", "include_hov3", "include_hot", "alley_factor"]
60
+
61
+ model_config = ConfigDict(
62
+ populate_by_name=True,
63
+ validate_assignment=True,
64
+ protected_namespaces=(),
65
+ )
54
66
 
55
- class Config:
56
- """Pydantic configuration"""
57
- allow_population_by_field_name = True
58
- validate_assignment = True
59
67
 
60
68
  def to_str(self) -> str:
61
69
  """Returns the string representation of the model using alias"""
62
- return pprint.pformat(self.dict(by_alias=True))
70
+ return pprint.pformat(self.model_dump(by_alias=True))
63
71
 
64
72
  def to_json(self) -> str:
65
73
  """Returns the JSON representation of the model using alias"""
74
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
75
  return json.dumps(self.to_dict())
67
76
 
68
77
  @classmethod
69
- def from_json(cls, json_str: str) -> AutoCostingOptions:
78
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
79
  """Create an instance of AutoCostingOptions from a JSON string"""
71
80
  return cls.from_dict(json.loads(json_str))
72
81
 
73
- def to_dict(self):
74
- """Returns the dictionary representation of the model using alias"""
75
- _dict = self.dict(by_alias=True,
76
- exclude={
77
- "additional_properties"
78
- },
79
- exclude_none=True)
82
+ def to_dict(self) -> Dict[str, Any]:
83
+ """Return the dictionary representation of the model using alias.
84
+
85
+ This has the following differences from calling pydantic's
86
+ `self.model_dump(by_alias=True)`:
87
+
88
+ * `None` is only added to the output dict for nullable fields that
89
+ were set at model initialization. Other fields with value `None`
90
+ are ignored.
91
+ * Fields in `self.additional_properties` are added to the output dict.
92
+ """
93
+ excluded_fields: Set[str] = set([
94
+ "additional_properties",
95
+ ])
96
+
97
+ _dict = self.model_dump(
98
+ by_alias=True,
99
+ exclude=excluded_fields,
100
+ exclude_none=True,
101
+ )
80
102
  # puts key-value pairs in additional_properties in the top level
81
103
  if self.additional_properties is not None:
82
104
  for _key, _value in self.additional_properties.items():
@@ -85,15 +107,15 @@ class AutoCostingOptions(BaseModel):
85
107
  return _dict
86
108
 
87
109
  @classmethod
88
- def from_dict(cls, obj: dict) -> AutoCostingOptions:
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
111
  """Create an instance of AutoCostingOptions from a dict"""
90
112
  if obj is None:
91
113
  return None
92
114
 
93
115
  if not isinstance(obj, dict):
94
- return AutoCostingOptions.parse_obj(obj)
116
+ return cls.model_validate(obj)
95
117
 
96
- _obj = AutoCostingOptions.parse_obj({
118
+ _obj = cls.model_validate({
97
119
  "maneuver_penalty": obj.get("maneuver_penalty") if obj.get("maneuver_penalty") is not None else 5,
98
120
  "gate_cost": obj.get("gate_cost") if obj.get("gate_cost") is not None else 15,
99
121
  "gate_penalty": obj.get("gate_penalty") if obj.get("gate_penalty") is not None else 300,
@@ -103,6 +125,9 @@ class AutoCostingOptions(BaseModel):
103
125
  "service_factor": obj.get("service_factor") if obj.get("service_factor") is not None else 1,
104
126
  "use_living_streets": obj.get("use_living_streets"),
105
127
  "use_ferry": obj.get("use_ferry") if obj.get("use_ferry") is not None else 0.5,
128
+ "ignore_restrictions": obj.get("ignore_restrictions"),
129
+ "ignore_non_vehicular_restrictions": obj.get("ignore_non_vehicular_restrictions"),
130
+ "ignore_oneways": obj.get("ignore_oneways"),
106
131
  "height": obj.get("height") if obj.get("height") is not None else 1.9,
107
132
  "width": obj.get("width") if obj.get("width") is not None else 1.6,
108
133
  "toll_booth_cost": obj.get("toll_booth_cost") if obj.get("toll_booth_cost") is not None else 15,
@@ -116,7 +141,8 @@ class AutoCostingOptions(BaseModel):
116
141
  "ignore_closures": obj.get("ignore_closures") if obj.get("ignore_closures") is not None else False,
117
142
  "include_hov2": obj.get("include_hov2") if obj.get("include_hov2") is not None else False,
118
143
  "include_hov3": obj.get("include_hov3") if obj.get("include_hov3") is not None else False,
119
- "include_hot": obj.get("include_hot") if obj.get("include_hot") is not None else False
144
+ "include_hot": obj.get("include_hot") if obj.get("include_hot") is not None else False,
145
+ "alley_factor": obj.get("alley_factor") if obj.get("alley_factor") is not None else 1
120
146
  })
121
147
  # store additional fields in additional_properties
122
148
  for _key in obj.keys():
@@ -125,3 +151,4 @@ class AutoCostingOptions(BaseModel):
125
151
 
126
152
  return _obj
127
153
 
154
+
@@ -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,51 +18,72 @@ 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, confloat, conint
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt
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 BaseCostingOptions(BaseModel):
26
28
  """
27
29
  BaseCostingOptions
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.")
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
+ ignore_restrictions: Optional[StrictBool] = Field(default=None, description="If set to true, ignores any restrictions (eg: turn and conditional restrictions). Useful for matching GPS traces to the road network regardless of restrictions.")
41
+ ignore_non_vehicular_restrictions: Optional[StrictBool] = Field(default=None, description="If set to true, ignores most restrictions (eg: turn and conditional restrictions), but still respects restrictions that impact vehicle safety such as weight and size.")
42
+ ignore_oneways: Optional[StrictBool] = Field(default=None, description="If set to true, ignores directional restrictions on roads. Useful for matching GPS traces to the road network regardless of restrictions.")
38
43
  additional_properties: Dict[str, Any] = {}
39
- __properties = ["maneuver_penalty", "gate_cost", "gate_penalty", "country_crossing_cost", "country_crossing_penalty", "service_penalty", "service_factor", "use_living_streets", "use_ferry"]
44
+ __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", "ignore_restrictions", "ignore_non_vehicular_restrictions", "ignore_oneways"]
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
40
51
 
41
- class Config:
42
- """Pydantic configuration"""
43
- allow_population_by_field_name = True
44
- validate_assignment = True
45
52
 
46
53
  def to_str(self) -> str:
47
54
  """Returns the string representation of the model using alias"""
48
- return pprint.pformat(self.dict(by_alias=True))
55
+ return pprint.pformat(self.model_dump(by_alias=True))
49
56
 
50
57
  def to_json(self) -> str:
51
58
  """Returns the JSON representation of the model using alias"""
59
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
60
  return json.dumps(self.to_dict())
53
61
 
54
62
  @classmethod
55
- def from_json(cls, json_str: str) -> BaseCostingOptions:
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
64
  """Create an instance of BaseCostingOptions from a JSON string"""
57
65
  return cls.from_dict(json.loads(json_str))
58
66
 
59
- def to_dict(self):
60
- """Returns the dictionary representation of the model using alias"""
61
- _dict = self.dict(by_alias=True,
62
- exclude={
63
- "additional_properties"
64
- },
65
- exclude_none=True)
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ * Fields in `self.additional_properties` are added to the output dict.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ "additional_properties",
80
+ ])
81
+
82
+ _dict = self.model_dump(
83
+ by_alias=True,
84
+ exclude=excluded_fields,
85
+ exclude_none=True,
86
+ )
66
87
  # puts key-value pairs in additional_properties in the top level
67
88
  if self.additional_properties is not None:
68
89
  for _key, _value in self.additional_properties.items():
@@ -71,15 +92,15 @@ class BaseCostingOptions(BaseModel):
71
92
  return _dict
72
93
 
73
94
  @classmethod
74
- def from_dict(cls, obj: dict) -> BaseCostingOptions:
95
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
96
  """Create an instance of BaseCostingOptions from a dict"""
76
97
  if obj is None:
77
98
  return None
78
99
 
79
100
  if not isinstance(obj, dict):
80
- return BaseCostingOptions.parse_obj(obj)
101
+ return cls.model_validate(obj)
81
102
 
82
- _obj = BaseCostingOptions.parse_obj({
103
+ _obj = cls.model_validate({
83
104
  "maneuver_penalty": obj.get("maneuver_penalty") if obj.get("maneuver_penalty") is not None else 5,
84
105
  "gate_cost": obj.get("gate_cost") if obj.get("gate_cost") is not None else 15,
85
106
  "gate_penalty": obj.get("gate_penalty") if obj.get("gate_penalty") is not None else 300,
@@ -88,7 +109,10 @@ class BaseCostingOptions(BaseModel):
88
109
  "service_penalty": obj.get("service_penalty"),
89
110
  "service_factor": obj.get("service_factor") if obj.get("service_factor") is not None else 1,
90
111
  "use_living_streets": obj.get("use_living_streets"),
91
- "use_ferry": obj.get("use_ferry") if obj.get("use_ferry") is not None else 0.5
112
+ "use_ferry": obj.get("use_ferry") if obj.get("use_ferry") is not None else 0.5,
113
+ "ignore_restrictions": obj.get("ignore_restrictions"),
114
+ "ignore_non_vehicular_restrictions": obj.get("ignore_non_vehicular_restrictions"),
115
+ "ignore_oneways": obj.get("ignore_oneways")
92
116
  })
93
117
  # store additional fields in additional_properties
94
118
  for _key in obj.keys():
@@ -97,3 +121,4 @@ class BaseCostingOptions(BaseModel):
97
121
 
98
122
  return _obj
99
123
 
124
+