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,56 +18,73 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import Any, Dict, Optional
23
- from pydantic import BaseModel, StrictStr, validator
21
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.isochrone_properties import IsochroneProperties
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
25
26
 
26
27
  class IsochroneFeature(BaseModel):
27
28
  """
28
29
  IsochroneFeature
29
- """
30
+ """ # noqa: E501
30
31
  properties: Optional[IsochroneProperties] = None
31
32
  geometry: Optional[Dict[str, Any]] = None
32
33
  type: Optional[StrictStr] = None
33
34
  additional_properties: Dict[str, Any] = {}
34
- __properties = ["properties", "geometry", "type"]
35
+ __properties: ClassVar[List[str]] = ["properties", "geometry", "type"]
35
36
 
36
- @validator('type')
37
+ @field_validator('type')
37
38
  def type_validate_enum(cls, value):
38
39
  """Validates the enum"""
39
40
  if value is None:
40
41
  return value
41
42
 
42
- if value not in ('Feature'):
43
+ if value not in set(['Feature']):
43
44
  raise ValueError("must be one of enum values ('Feature')")
44
45
  return value
45
46
 
46
- class Config:
47
- """Pydantic configuration"""
48
- allow_population_by_field_name = True
49
- validate_assignment = True
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
52
+
50
53
 
51
54
  def to_str(self) -> str:
52
55
  """Returns the string representation of the model using alias"""
53
- return pprint.pformat(self.dict(by_alias=True))
56
+ return pprint.pformat(self.model_dump(by_alias=True))
54
57
 
55
58
  def to_json(self) -> str:
56
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
57
61
  return json.dumps(self.to_dict())
58
62
 
59
63
  @classmethod
60
- def from_json(cls, json_str: str) -> IsochroneFeature:
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
65
  """Create an instance of IsochroneFeature from a JSON string"""
62
66
  return cls.from_dict(json.loads(json_str))
63
67
 
64
- def to_dict(self):
65
- """Returns the dictionary representation of the model using alias"""
66
- _dict = self.dict(by_alias=True,
67
- exclude={
68
- "additional_properties"
69
- },
70
- 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
+ )
71
88
  # override the default output from pydantic by calling `to_dict()` of properties
72
89
  if self.properties:
73
90
  _dict['properties'] = self.properties.to_dict()
@@ -79,16 +96,16 @@ class IsochroneFeature(BaseModel):
79
96
  return _dict
80
97
 
81
98
  @classmethod
82
- def from_dict(cls, obj: dict) -> IsochroneFeature:
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
100
  """Create an instance of IsochroneFeature from a dict"""
84
101
  if obj is None:
85
102
  return None
86
103
 
87
104
  if not isinstance(obj, dict):
88
- return IsochroneFeature.parse_obj(obj)
105
+ return cls.model_validate(obj)
89
106
 
90
- _obj = IsochroneFeature.parse_obj({
91
- "properties": IsochroneProperties.from_dict(obj.get("properties")) if obj.get("properties") is not None else None,
107
+ _obj = cls.model_validate({
108
+ "properties": IsochroneProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None,
92
109
  "geometry": obj.get("geometry"),
93
110
  "type": obj.get("type")
94
111
  })
@@ -99,3 +116,4 @@ class IsochroneFeature(BaseModel):
99
116
 
100
117
  return _obj
101
118
 
119
+
@@ -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,59 +18,76 @@ 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, StrictFloat, StrictInt, StrictStr, field_validator
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 IsochroneProperties(BaseModel):
26
27
  """
27
28
  IsochroneProperties
28
- """
29
- fill_color: Optional[StrictStr] = Field(None, alias="fillColor")
29
+ """ # noqa: E501
30
+ fill_color: Optional[StrictStr] = Field(default=None, alias="fillColor")
30
31
  opacity: Optional[Union[StrictFloat, StrictInt]] = None
31
32
  fill: Optional[StrictStr] = None
32
- fill_opacity: Optional[Union[StrictFloat, StrictInt]] = Field(None, alias="fillOpacity")
33
+ fill_opacity: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="fillOpacity")
33
34
  color: Optional[StrictStr] = None
34
35
  contour: Optional[Union[StrictFloat, StrictInt]] = None
35
36
  metric: Optional[StrictStr] = None
36
37
  additional_properties: Dict[str, Any] = {}
37
- __properties = ["fillColor", "opacity", "fill", "fillOpacity", "color", "contour", "metric"]
38
+ __properties: ClassVar[List[str]] = ["fillColor", "opacity", "fill", "fillOpacity", "color", "contour", "metric"]
38
39
 
39
- @validator('metric')
40
+ @field_validator('metric')
40
41
  def metric_validate_enum(cls, value):
41
42
  """Validates the enum"""
42
43
  if value is None:
43
44
  return value
44
45
 
45
- if value not in ('time', 'distance'):
46
+ if value not in set(['time', 'distance']):
46
47
  raise ValueError("must be one of enum values ('time', 'distance')")
47
48
  return value
48
49
 
49
- class Config:
50
- """Pydantic configuration"""
51
- allow_population_by_field_name = True
52
- validate_assignment = True
50
+ model_config = ConfigDict(
51
+ populate_by_name=True,
52
+ validate_assignment=True,
53
+ protected_namespaces=(),
54
+ )
55
+
53
56
 
54
57
  def to_str(self) -> str:
55
58
  """Returns the string representation of the model using alias"""
56
- return pprint.pformat(self.dict(by_alias=True))
59
+ return pprint.pformat(self.model_dump(by_alias=True))
57
60
 
58
61
  def to_json(self) -> str:
59
62
  """Returns the JSON representation of the model using alias"""
63
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60
64
  return json.dumps(self.to_dict())
61
65
 
62
66
  @classmethod
63
- def from_json(cls, json_str: str) -> IsochroneProperties:
67
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
68
  """Create an instance of IsochroneProperties from a JSON string"""
65
69
  return cls.from_dict(json.loads(json_str))
66
70
 
67
- def to_dict(self):
68
- """Returns the dictionary representation of the model using alias"""
69
- _dict = self.dict(by_alias=True,
70
- exclude={
71
- "additional_properties"
72
- },
73
- exclude_none=True)
71
+ def to_dict(self) -> Dict[str, Any]:
72
+ """Return the dictionary representation of the model using alias.
73
+
74
+ This has the following differences from calling pydantic's
75
+ `self.model_dump(by_alias=True)`:
76
+
77
+ * `None` is only added to the output dict for nullable fields that
78
+ were set at model initialization. Other fields with value `None`
79
+ are ignored.
80
+ * Fields in `self.additional_properties` are added to the output dict.
81
+ """
82
+ excluded_fields: Set[str] = set([
83
+ "additional_properties",
84
+ ])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
74
91
  # puts key-value pairs in additional_properties in the top level
75
92
  if self.additional_properties is not None:
76
93
  for _key, _value in self.additional_properties.items():
@@ -79,19 +96,19 @@ class IsochroneProperties(BaseModel):
79
96
  return _dict
80
97
 
81
98
  @classmethod
82
- def from_dict(cls, obj: dict) -> IsochroneProperties:
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
100
  """Create an instance of IsochroneProperties from a dict"""
84
101
  if obj is None:
85
102
  return None
86
103
 
87
104
  if not isinstance(obj, dict):
88
- return IsochroneProperties.parse_obj(obj)
105
+ return cls.model_validate(obj)
89
106
 
90
- _obj = IsochroneProperties.parse_obj({
91
- "fill_color": obj.get("fillColor"),
107
+ _obj = cls.model_validate({
108
+ "fillColor": obj.get("fillColor"),
92
109
  "opacity": obj.get("opacity"),
93
110
  "fill": obj.get("fill"),
94
- "fill_opacity": obj.get("fillOpacity"),
111
+ "fillOpacity": obj.get("fillOpacity"),
95
112
  "color": obj.get("color"),
96
113
  "contour": obj.get("contour"),
97
114
  "metric": obj.get("metric")
@@ -103,3 +120,4 @@ class IsochroneProperties(BaseModel):
103
120
 
104
121
  return _obj
105
122
 
123
+
@@ -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,55 +18,73 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import List, Optional, Union
23
- from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, confloat, conint, conlist
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing_extensions import Annotated
24
24
  from stadiamaps.models.contour import Contour
25
25
  from stadiamaps.models.coordinate import Coordinate
26
26
  from stadiamaps.models.costing_options import CostingOptions
27
27
  from stadiamaps.models.isochrone_costing_model import IsochroneCostingModel
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
28
30
 
29
31
  class IsochroneRequest(BaseModel):
30
32
  """
31
33
  IsochroneRequest
32
- """
33
- id: Optional[StrictStr] = Field(None, description="An identifier to disambiguate requests (echoed by the server).")
34
- locations: conlist(Coordinate) = Field(...)
35
- costing: IsochroneCostingModel = Field(...)
34
+ """ # noqa: E501
35
+ id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
36
+ locations: List[Coordinate]
37
+ costing: IsochroneCostingModel
36
38
  costing_options: Optional[CostingOptions] = None
37
- contours: conlist(Contour, max_items=4, min_items=1) = Field(...)
38
- polygons: Optional[StrictBool] = Field(False, description="If true, the generated GeoJSON will use polygons. The default is to use LineStrings. Polygon output makes it easier to render overlapping areas in some visualization tools (such as MapLibre renderers).")
39
- denoise: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = Field(1, description="A value in the range [0, 1] which will be used to smooth out or remove smaller contours. A value of 1 will only return the largest contour for a given time value. A value of 0.5 drops any contours that are less than half the area of the largest contour in the set of contours for that same time value.")
40
- generalize: Optional[Union[StrictFloat, StrictInt]] = Field(200.0, description="The value in meters to be used as a tolerance for Douglas-Peucker generalization.")
41
- show_locations: Optional[StrictBool] = Field(False, description="If true, then the output GeoJSON will include the input locations as two MultiPoint features: one for the exact input coordinates, and a second for the route network node location that the point was snapped to.")
39
+ contours: Annotated[List[Contour], Field(min_length=1, max_length=4)]
40
+ polygons: Optional[StrictBool] = Field(default=False, description="If true, the generated GeoJSON will use polygons. The default is to use LineStrings. Polygon output makes it easier to render overlapping areas in some visualization tools (such as MapLibre renderers).")
41
+ denoise: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=1, description="A value in the range [0, 1] which will be used to smooth out or remove smaller contours. A value of 1 will only return the largest contour for a given time value. A value of 0.5 drops any contours that are less than half the area of the largest contour in the set of contours for that same time value.")
42
+ generalize: Optional[Union[StrictFloat, StrictInt]] = Field(default=200.0, description="The value in meters to be used as a tolerance for Douglas-Peucker generalization.")
43
+ show_locations: Optional[StrictBool] = Field(default=False, description="If true, then the output GeoJSON will include the input locations as two MultiPoint features: one for the exact input coordinates, and a second for the route network node location that the point was snapped to.")
42
44
  additional_properties: Dict[str, Any] = {}
43
- __properties = ["id", "locations", "costing", "costing_options", "contours", "polygons", "denoise", "generalize", "show_locations"]
45
+ __properties: ClassVar[List[str]] = ["id", "locations", "costing", "costing_options", "contours", "polygons", "denoise", "generalize", "show_locations"]
46
+
47
+ model_config = ConfigDict(
48
+ populate_by_name=True,
49
+ validate_assignment=True,
50
+ protected_namespaces=(),
51
+ )
44
52
 
45
- class Config:
46
- """Pydantic configuration"""
47
- allow_population_by_field_name = True
48
- validate_assignment = True
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) -> IsochroneRequest:
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
65
  """Create an instance of IsochroneRequest 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
  # override the default output from pydantic by calling `to_dict()` of each item in locations (list)
71
89
  _items = []
72
90
  if self.locations:
@@ -92,20 +110,20 @@ class IsochroneRequest(BaseModel):
92
110
  return _dict
93
111
 
94
112
  @classmethod
95
- def from_dict(cls, obj: dict) -> IsochroneRequest:
113
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
114
  """Create an instance of IsochroneRequest from a dict"""
97
115
  if obj is None:
98
116
  return None
99
117
 
100
118
  if not isinstance(obj, dict):
101
- return IsochroneRequest.parse_obj(obj)
119
+ return cls.model_validate(obj)
102
120
 
103
- _obj = IsochroneRequest.parse_obj({
121
+ _obj = cls.model_validate({
104
122
  "id": obj.get("id"),
105
- "locations": [Coordinate.from_dict(_item) for _item in obj.get("locations")] if obj.get("locations") is not None else None,
123
+ "locations": [Coordinate.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None,
106
124
  "costing": obj.get("costing"),
107
- "costing_options": CostingOptions.from_dict(obj.get("costing_options")) if obj.get("costing_options") is not None else None,
108
- "contours": [Contour.from_dict(_item) for _item in obj.get("contours")] if obj.get("contours") is not None else None,
125
+ "costing_options": CostingOptions.from_dict(obj["costing_options"]) if obj.get("costing_options") is not None else None,
126
+ "contours": [Contour.from_dict(_item) for _item in obj["contours"]] if obj.get("contours") is not None else None,
109
127
  "polygons": obj.get("polygons") if obj.get("polygons") is not None else False,
110
128
  "denoise": obj.get("denoise") if obj.get("denoise") is not None else 1,
111
129
  "generalize": obj.get("generalize") if obj.get("generalize") is not None else 200.0,
@@ -118,3 +136,4 @@ class IsochroneRequest(BaseModel):
118
136
 
119
137
  return _obj
120
138
 
139
+
@@ -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,53 +18,70 @@ 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, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.isochrone_feature import IsochroneFeature
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
25
26
 
26
27
  class IsochroneResponse(BaseModel):
27
28
  """
28
29
  IsochroneResponse
29
- """
30
+ """ # noqa: E501
30
31
  id: Optional[StrictStr] = None
31
- features: conlist(IsochroneFeature) = Field(...)
32
- type: StrictStr = Field(...)
32
+ features: List[IsochroneFeature]
33
+ type: StrictStr
33
34
  additional_properties: Dict[str, Any] = {}
34
- __properties = ["id", "features", "type"]
35
+ __properties: ClassVar[List[str]] = ["id", "features", "type"]
35
36
 
36
- @validator('type')
37
+ @field_validator('type')
37
38
  def type_validate_enum(cls, value):
38
39
  """Validates the enum"""
39
- if value not in ('FeatureCollection'):
40
+ if value not in set(['FeatureCollection']):
40
41
  raise ValueError("must be one of enum values ('FeatureCollection')")
41
42
  return value
42
43
 
43
- class Config:
44
- """Pydantic configuration"""
45
- allow_population_by_field_name = True
46
- validate_assignment = True
44
+ model_config = ConfigDict(
45
+ populate_by_name=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
47
50
 
48
51
  def to_str(self) -> str:
49
52
  """Returns the string representation of the model using alias"""
50
- return pprint.pformat(self.dict(by_alias=True))
53
+ return pprint.pformat(self.model_dump(by_alias=True))
51
54
 
52
55
  def to_json(self) -> str:
53
56
  """Returns the JSON representation of the model using alias"""
57
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
58
  return json.dumps(self.to_dict())
55
59
 
56
60
  @classmethod
57
- def from_json(cls, json_str: str) -> IsochroneResponse:
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
62
  """Create an instance of IsochroneResponse from a JSON string"""
59
63
  return cls.from_dict(json.loads(json_str))
60
64
 
61
- def to_dict(self):
62
- """Returns the dictionary representation of the model using alias"""
63
- _dict = self.dict(by_alias=True,
64
- exclude={
65
- "additional_properties"
66
- },
67
- exclude_none=True)
65
+ def to_dict(self) -> Dict[str, Any]:
66
+ """Return the dictionary representation of the model using alias.
67
+
68
+ This has the following differences from calling pydantic's
69
+ `self.model_dump(by_alias=True)`:
70
+
71
+ * `None` is only added to the output dict for nullable fields that
72
+ were set at model initialization. Other fields with value `None`
73
+ are ignored.
74
+ * Fields in `self.additional_properties` are added to the output dict.
75
+ """
76
+ excluded_fields: Set[str] = set([
77
+ "additional_properties",
78
+ ])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
68
85
  # override the default output from pydantic by calling `to_dict()` of each item in features (list)
69
86
  _items = []
70
87
  if self.features:
@@ -80,17 +97,17 @@ class IsochroneResponse(BaseModel):
80
97
  return _dict
81
98
 
82
99
  @classmethod
83
- def from_dict(cls, obj: dict) -> IsochroneResponse:
100
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
101
  """Create an instance of IsochroneResponse from a dict"""
85
102
  if obj is None:
86
103
  return None
87
104
 
88
105
  if not isinstance(obj, dict):
89
- return IsochroneResponse.parse_obj(obj)
106
+ return cls.model_validate(obj)
90
107
 
91
- _obj = IsochroneResponse.parse_obj({
108
+ _obj = cls.model_validate({
92
109
  "id": obj.get("id"),
93
- "features": [IsochroneFeature.from_dict(_item) for _item in obj.get("features")] if obj.get("features") is not None else None,
110
+ "features": [IsochroneFeature.from_dict(_item) for _item in obj["features"]] if obj.get("features") is not None else None,
94
111
  "type": obj.get("type")
95
112
  })
96
113
  # store additional fields in additional_properties
@@ -100,3 +117,4 @@ class IsochroneResponse(BaseModel):
100
117
 
101
118
  return _obj
102
119
 
120
+