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,23 +3,20 @@
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
+ from __future__ import annotations
16
17
  import json
17
- import pprint
18
- import re # noqa: F401
19
- from aenum import Enum, no_arg
20
-
21
-
22
-
18
+ from enum import Enum
19
+ from typing_extensions import Self
23
20
 
24
21
 
25
22
  class EdgeUse(str, Enum):
@@ -63,8 +60,8 @@ class EdgeUse(str, Enum):
63
60
  TRANSIT_CONNECTION = 'transit_connection'
64
61
 
65
62
  @classmethod
66
- def from_json(cls, json_str: str) -> EdgeUse:
63
+ def from_json(cls, json_str: str) -> Self:
67
64
  """Create an instance of EdgeUse from a JSON string"""
68
- return EdgeUse(json.loads(json_str))
65
+ return cls(json.loads(json_str))
69
66
 
70
67
 
@@ -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,50 +18,67 @@ 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, conlist
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
24
23
  from stadiamaps.models.intersecting_edge import IntersectingEdge
25
24
  from stadiamaps.models.node_type import NodeType
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
26
27
 
27
28
  class EndNode(BaseModel):
28
29
  """
29
30
  The node at the end of this edge
30
- """
31
- intersecting_edges: Optional[conlist(IntersectingEdge)] = Field(None, description="A set of edges intersecting this node.")
32
- elapsed_time: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The elapsed time along the path to arrive at this node.")
33
- admin_index: Optional[StrictInt] = Field(None, description="The index into the `admins` list in which this node lies.")
31
+ """ # noqa: E501
32
+ intersecting_edges: Optional[List[IntersectingEdge]] = Field(default=None, description="A set of edges intersecting this node.")
33
+ elapsed_time: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The elapsed time along the path to arrive at this node.")
34
+ admin_index: Optional[StrictInt] = Field(default=None, description="The index into the `admins` list in which this node lies.")
34
35
  type: Optional[NodeType] = None
35
- fork: Optional[StrictBool] = Field(None, description="True if this node is a fork.")
36
- time_zone: Optional[StrictStr] = Field(None, description="The canonical TZDB identifier for the node's time zone.")
36
+ fork: Optional[StrictBool] = Field(default=None, description="True if this node is a fork.")
37
+ time_zone: Optional[StrictStr] = Field(default=None, description="The canonical TZDB identifier for the node's time zone.")
37
38
  additional_properties: Dict[str, Any] = {}
38
- __properties = ["intersecting_edges", "elapsed_time", "admin_index", "type", "fork", "time_zone"]
39
+ __properties: ClassVar[List[str]] = ["intersecting_edges", "elapsed_time", "admin_index", "type", "fork", "time_zone"]
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
39
46
 
40
- class Config:
41
- """Pydantic configuration"""
42
- allow_population_by_field_name = True
43
- validate_assignment = True
44
47
 
45
48
  def to_str(self) -> str:
46
49
  """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.dict(by_alias=True))
50
+ return pprint.pformat(self.model_dump(by_alias=True))
48
51
 
49
52
  def to_json(self) -> str:
50
53
  """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
55
  return json.dumps(self.to_dict())
52
56
 
53
57
  @classmethod
54
- def from_json(cls, json_str: str) -> EndNode:
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
59
  """Create an instance of EndNode from a JSON string"""
56
60
  return cls.from_dict(json.loads(json_str))
57
61
 
58
- def to_dict(self):
59
- """Returns the dictionary representation of the model using alias"""
60
- _dict = self.dict(by_alias=True,
61
- exclude={
62
- "additional_properties"
63
- },
64
- exclude_none=True)
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ * Fields in `self.additional_properties` are added to the output dict.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ "additional_properties",
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
65
82
  # override the default output from pydantic by calling `to_dict()` of each item in intersecting_edges (list)
66
83
  _items = []
67
84
  if self.intersecting_edges:
@@ -77,16 +94,16 @@ class EndNode(BaseModel):
77
94
  return _dict
78
95
 
79
96
  @classmethod
80
- def from_dict(cls, obj: dict) -> EndNode:
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
98
  """Create an instance of EndNode from a dict"""
82
99
  if obj is None:
83
100
  return None
84
101
 
85
102
  if not isinstance(obj, dict):
86
- return EndNode.parse_obj(obj)
103
+ return cls.model_validate(obj)
87
104
 
88
- _obj = EndNode.parse_obj({
89
- "intersecting_edges": [IntersectingEdge.from_dict(_item) for _item in obj.get("intersecting_edges")] if obj.get("intersecting_edges") is not None else None,
105
+ _obj = cls.model_validate({
106
+ "intersecting_edges": [IntersectingEdge.from_dict(_item) for _item in obj["intersecting_edges"]] if obj.get("intersecting_edges") is not None else None,
90
107
  "elapsed_time": obj.get("elapsed_time"),
91
108
  "admin_index": obj.get("admin_index"),
92
109
  "type": obj.get("type"),
@@ -100,3 +117,4 @@ class EndNode(BaseModel):
100
117
 
101
118
  return _obj
102
119
 
120
+
@@ -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,47 +18,64 @@ 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
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
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 GeoAttributes(BaseModel):
26
27
  """
27
28
  GeoAttributes
28
- """
29
- curvature: Optional[StrictInt] = Field(None, description="Curvature factor.")
30
- max_down_slope: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The maximum downward slope. Uses 1 degree precision for slopes to -16 degrees, and 4 degree precision afterwards (up to a max of -76 degrees).")
31
- max_up_slope: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The maximum upward slope. Uses 1 degree precision for slopes to 16 degrees, and 4 degree precision afterwards (up to a max of 76 degrees).")
32
- weighted_grade: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The weighted estimate of the grade.")
33
- length: Optional[StrictInt] = Field(None, description="The length of the edge, in meters.")
29
+ """ # noqa: E501
30
+ curvature: Optional[StrictInt] = Field(default=None, description="Curvature factor.")
31
+ max_down_slope: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The maximum downward slope. Uses 1 degree precision for slopes to -16 degrees, and 4 degree precision afterwards (up to a max of -76 degrees).")
32
+ max_up_slope: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The maximum upward slope. Uses 1 degree precision for slopes to 16 degrees, and 4 degree precision afterwards (up to a max of 76 degrees).")
33
+ weighted_grade: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The weighted estimate of the grade.")
34
+ length: Optional[StrictInt] = Field(default=None, description="The length of the edge, in meters.")
34
35
  additional_properties: Dict[str, Any] = {}
35
- __properties = ["curvature", "max_down_slope", "max_up_slope", "weighted_grade", "length"]
36
+ __properties: ClassVar[List[str]] = ["curvature", "max_down_slope", "max_up_slope", "weighted_grade", "length"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
36
43
 
37
- class Config:
38
- """Pydantic configuration"""
39
- allow_population_by_field_name = True
40
- validate_assignment = True
41
44
 
42
45
  def to_str(self) -> str:
43
46
  """Returns the string representation of the model using alias"""
44
- return pprint.pformat(self.dict(by_alias=True))
47
+ return pprint.pformat(self.model_dump(by_alias=True))
45
48
 
46
49
  def to_json(self) -> str:
47
50
  """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
52
  return json.dumps(self.to_dict())
49
53
 
50
54
  @classmethod
51
- def from_json(cls, json_str: str) -> GeoAttributes:
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
56
  """Create an instance of GeoAttributes from a JSON string"""
53
57
  return cls.from_dict(json.loads(json_str))
54
58
 
55
- def to_dict(self):
56
- """Returns the dictionary representation of the model using alias"""
57
- _dict = self.dict(by_alias=True,
58
- exclude={
59
- "additional_properties"
60
- },
61
- exclude_none=True)
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ * Fields in `self.additional_properties` are added to the output dict.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ "additional_properties",
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
62
79
  # puts key-value pairs in additional_properties in the top level
63
80
  if self.additional_properties is not None:
64
81
  for _key, _value in self.additional_properties.items():
@@ -67,15 +84,15 @@ class GeoAttributes(BaseModel):
67
84
  return _dict
68
85
 
69
86
  @classmethod
70
- def from_dict(cls, obj: dict) -> GeoAttributes:
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
71
88
  """Create an instance of GeoAttributes from a dict"""
72
89
  if obj is None:
73
90
  return None
74
91
 
75
92
  if not isinstance(obj, dict):
76
- return GeoAttributes.parse_obj(obj)
93
+ return cls.model_validate(obj)
77
94
 
78
- _obj = GeoAttributes.parse_obj({
95
+ _obj = cls.model_validate({
79
96
  "curvature": obj.get("curvature"),
80
97
  "max_down_slope": obj.get("max_down_slope"),
81
98
  "max_up_slope": obj.get("max_up_slope"),
@@ -89,3 +106,4 @@ class GeoAttributes(BaseModel):
89
106
 
90
107
  return _obj
91
108
 
109
+
@@ -3,29 +3,27 @@
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
17
- from inspect import getfullargspec
18
17
  import json
19
18
  import pprint
20
- import re # noqa: F401
21
-
19
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
22
20
  from typing import Any, List, Optional
23
- from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
24
21
  from stadiamaps.models.geo_json_line_string import GeoJSONLineString
25
22
  from stadiamaps.models.geo_json_point import GeoJSONPoint
26
23
  from stadiamaps.models.geo_json_polygon import GeoJSONPolygon
27
- from typing import Any, List
28
24
  from pydantic import StrictStr, Field
25
+ from typing import Union, List, Optional, Dict
26
+ from typing_extensions import Literal, Self
29
27
 
30
28
  GEOJSONGEOMETRY_ONE_OF_SCHEMAS = ["GeoJSONLineString", "GeoJSONPoint", "GeoJSONPolygon"]
31
29
 
@@ -39,16 +37,19 @@ class GeoJSONGeometry(BaseModel):
39
37
  oneof_schema_2_validator: Optional[GeoJSONLineString] = None
40
38
  # data type: GeoJSONPolygon
41
39
  oneof_schema_3_validator: Optional[GeoJSONPolygon] = None
42
- actual_instance: Any
43
- one_of_schemas: List[str] = Field(GEOJSONGEOMETRY_ONE_OF_SCHEMAS, const=True)
40
+ actual_instance: Optional[Union[GeoJSONLineString, GeoJSONPoint, GeoJSONPolygon]] = None
41
+ one_of_schemas: List[str] = Field(default=Literal["GeoJSONLineString", "GeoJSONPoint", "GeoJSONPolygon"])
44
42
 
45
- class Config:
46
- validate_assignment = True
43
+ model_config = ConfigDict(
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
47
 
48
- discriminator_value_class_map = {
48
+
49
+ discriminator_value_class_map: Dict[str, str] = {
49
50
  }
50
51
 
51
- def __init__(self, *args, **kwargs):
52
+ def __init__(self, *args, **kwargs) -> None:
52
53
  if args:
53
54
  if len(args) > 1:
54
55
  raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
@@ -58,9 +59,9 @@ class GeoJSONGeometry(BaseModel):
58
59
  else:
59
60
  super().__init__(**kwargs)
60
61
 
61
- @validator('actual_instance')
62
+ @field_validator('actual_instance')
62
63
  def actual_instance_must_validate_oneof(cls, v):
63
- instance = GeoJSONGeometry.construct()
64
+ instance = GeoJSONGeometry.model_construct()
64
65
  error_messages = []
65
66
  match = 0
66
67
  # validate data type: GeoJSONPoint
@@ -88,13 +89,13 @@ class GeoJSONGeometry(BaseModel):
88
89
  return v
89
90
 
90
91
  @classmethod
91
- def from_dict(cls, obj: dict) -> GeoJSONGeometry:
92
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
92
93
  return cls.from_json(json.dumps(obj))
93
94
 
94
95
  @classmethod
95
- def from_json(cls, json_str: str) -> GeoJSONGeometry:
96
+ def from_json(cls, json_str: str) -> Self:
96
97
  """Returns the object represented by the json string"""
97
- instance = GeoJSONGeometry.construct()
98
+ instance = cls.model_construct()
98
99
  error_messages = []
99
100
  match = 0
100
101
 
@@ -131,19 +132,17 @@ class GeoJSONGeometry(BaseModel):
131
132
  if self.actual_instance is None:
132
133
  return "null"
133
134
 
134
- to_json = getattr(self.actual_instance, "to_json", None)
135
- if callable(to_json):
135
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
136
136
  return self.actual_instance.to_json()
137
137
  else:
138
138
  return json.dumps(self.actual_instance)
139
139
 
140
- def to_dict(self) -> dict:
140
+ def to_dict(self) -> Optional[Union[Dict[str, Any], GeoJSONLineString, GeoJSONPoint, GeoJSONPolygon]]:
141
141
  """Returns the dict representation of the actual instance"""
142
142
  if self.actual_instance is None:
143
143
  return None
144
144
 
145
- to_dict = getattr(self.actual_instance, "to_dict", None)
146
- if callable(to_dict):
145
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
147
146
  return self.actual_instance.to_dict()
148
147
  else:
149
148
  # primitive type
@@ -151,5 +150,6 @@ class GeoJSONGeometry(BaseModel):
151
150
 
152
151
  def to_str(self) -> str:
153
152
  """Returns the string representation of the actual instance"""
154
- return pprint.pformat(self.dict())
153
+ return pprint.pformat(self.model_dump())
154
+
155
155
 
@@ -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,50 +18,67 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
-
23
- from pydantic import BaseModel, Field, StrictStr, validator
21
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
24
25
 
25
26
  class GeoJSONGeometryBase(BaseModel):
26
27
  """
27
28
  GeoJSONGeometryBase
28
- """
29
- type: StrictStr = Field(...)
29
+ """ # noqa: E501
30
+ type: StrictStr
30
31
  additional_properties: Dict[str, Any] = {}
31
- __properties = ["type"]
32
+ __properties: ClassVar[List[str]] = ["type"]
32
33
 
33
- @validator('type')
34
+ @field_validator('type')
34
35
  def type_validate_enum(cls, value):
35
36
  """Validates the enum"""
36
- if value not in ('Point', 'MultiPoint', 'LineString', 'MultiLineString', 'Polygon', 'MultiPolygon'):
37
+ if value not in set(['Point', 'MultiPoint', 'LineString', 'MultiLineString', 'Polygon', 'MultiPolygon']):
37
38
  raise ValueError("must be one of enum values ('Point', 'MultiPoint', 'LineString', 'MultiLineString', 'Polygon', 'MultiPolygon')")
38
39
  return value
39
40
 
40
- class Config:
41
- """Pydantic configuration"""
42
- allow_population_by_field_name = True
43
- validate_assignment = True
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
44
47
 
45
48
  def to_str(self) -> str:
46
49
  """Returns the string representation of the model using alias"""
47
- return pprint.pformat(self.dict(by_alias=True))
50
+ return pprint.pformat(self.model_dump(by_alias=True))
48
51
 
49
52
  def to_json(self) -> str:
50
53
  """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
55
  return json.dumps(self.to_dict())
52
56
 
53
57
  @classmethod
54
- def from_json(cls, json_str: str) -> GeoJSONGeometryBase:
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
59
  """Create an instance of GeoJSONGeometryBase from a JSON string"""
56
60
  return cls.from_dict(json.loads(json_str))
57
61
 
58
- def to_dict(self):
59
- """Returns the dictionary representation of the model using alias"""
60
- _dict = self.dict(by_alias=True,
61
- exclude={
62
- "additional_properties"
63
- },
64
- exclude_none=True)
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ * Fields in `self.additional_properties` are added to the output dict.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ "additional_properties",
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
65
82
  # puts key-value pairs in additional_properties in the top level
66
83
  if self.additional_properties is not None:
67
84
  for _key, _value in self.additional_properties.items():
@@ -70,15 +87,15 @@ class GeoJSONGeometryBase(BaseModel):
70
87
  return _dict
71
88
 
72
89
  @classmethod
73
- def from_dict(cls, obj: dict) -> GeoJSONGeometryBase:
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
74
91
  """Create an instance of GeoJSONGeometryBase from a dict"""
75
92
  if obj is None:
76
93
  return None
77
94
 
78
95
  if not isinstance(obj, dict):
79
- return GeoJSONGeometryBase.parse_obj(obj)
96
+ return cls.model_validate(obj)
80
97
 
81
- _obj = GeoJSONGeometryBase.parse_obj({
98
+ _obj = cls.model_validate({
82
99
  "type": obj.get("type")
83
100
  })
84
101
  # store additional fields in additional_properties
@@ -88,3 +105,4 @@ class GeoJSONGeometryBase(BaseModel):
88
105
 
89
106
  return _obj
90
107
 
108
+