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,58 +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, confloat, conint
21
+ from pydantic import BaseModel, ConfigDict, Field, 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 PedestrianCostingOptions(BaseModel):
26
28
  """
27
29
  PedestrianCostingOptions
28
- """
29
- walking_speed: Optional[conint(strict=True, le=25, ge=0)] = Field(None, description="Walking speed in kph.")
30
- walkway_factor: Optional[Union[StrictFloat, StrictInt]] = Field(1, description="A factor that multiplies the cost when walkways are encountered.")
31
- sidewalk_factor: Optional[Union[StrictFloat, StrictInt]] = Field(1, description="A factor that multiplies the cost when sidewalks are encountered.")
32
- alley_factor: Optional[Union[StrictFloat, StrictInt]] = Field(2, description="A factor that multiplies the cost when alleys are encountered.")
33
- driveway_factor: Optional[Union[StrictFloat, StrictInt]] = Field(5, description="A factor that multiplies the cost when driveways are encountered.")
34
- step_penalty: Optional[StrictInt] = Field(30, description="A penalty (in seconds) added to each transition onto a path with steps or stairs.")
35
- 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.")
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_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.")
38
- use_hills: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = Field(0.5, description="A measure of willingness to take tackle hills. Values near 0 attempt to avoid hills and steeper grades even if it means a longer route, and values near 1 indicates that the user does not fear them. Note that as some routes may be impossible without hills, 0 does not guarantee avoidance of them.")
39
- use_lit: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = Field(0, description="A measure of preference for streets that are lit. 0 indicates indifference toward lit streets, and 1 indicates that unlit streets should be avoided. Note that even with values near 1, there is no guarantee that the returned route will include lit segments.")
40
- 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.")
41
- 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.")
42
- max_hiking_difficulty: Optional[conint(strict=True, le=6, ge=1)] = Field(1, description="The maximum difficulty of hiking trails allowed. This corresponds to the OSM `sac_scale`.")
43
- bss_rent_cost: Optional[StrictInt] = Field(120, description="The estimated cost (in seconds) to rent a bicycle from a sharing station in `bikeshare` mode.")
44
- bss_rent_penalty: Optional[StrictInt] = Field(0, description="A penalty (in seconds) to rent a bicycle in `bikeshare` mode.")
30
+ """ # noqa: E501
31
+ walking_speed: Optional[Annotated[int, Field(le=25, strict=True, ge=0)]] = Field(default=None, description="Walking speed in kph.")
32
+ walkway_factor: Optional[Union[StrictFloat, StrictInt]] = Field(default=1, description="A factor that multiplies the cost when walkways are encountered.")
33
+ sidewalk_factor: Optional[Union[StrictFloat, StrictInt]] = Field(default=1, description="A factor that multiplies the cost when sidewalks are encountered.")
34
+ alley_factor: Optional[Union[StrictFloat, StrictInt]] = Field(default=2, description="A factor that multiplies the cost when alleys are encountered.")
35
+ driveway_factor: Optional[Union[StrictFloat, StrictInt]] = Field(default=5, description="A factor that multiplies the cost when driveways are encountered.")
36
+ step_penalty: Optional[StrictInt] = Field(default=30, description="A penalty (in seconds) added to each transition onto a path with steps or stairs.")
37
+ 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.")
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_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.")
40
+ use_hills: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0.5, description="A measure of willingness to take tackle hills. Values near 0 attempt to avoid hills and steeper grades even if it means a longer route, and values near 1 indicates that the user does not fear them. Note that as some routes may be impossible without hills, 0 does not guarantee avoidance of them.")
41
+ use_lit: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = Field(default=0, description="A measure of preference for streets that are lit. 0 indicates indifference toward lit streets, and 1 indicates that unlit streets should be avoided. Note that even with values near 1, there is no guarantee that the returned route will include lit segments.")
42
+ 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.")
43
+ 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.")
44
+ max_hiking_difficulty: Optional[Annotated[int, Field(le=6, strict=True, ge=1)]] = Field(default=1, description="The maximum difficulty of hiking trails allowed. This corresponds to the OSM `sac_scale`.")
45
+ bss_rent_cost: Optional[StrictInt] = Field(default=120, description="The estimated cost (in seconds) to rent a bicycle from a sharing station in `bikeshare` mode.")
46
+ bss_rent_penalty: Optional[StrictInt] = Field(default=0, description="A penalty (in seconds) to rent a bicycle in `bikeshare` mode.")
45
47
  additional_properties: Dict[str, Any] = {}
46
- __properties = ["walking_speed", "walkway_factor", "sidewalk_factor", "alley_factor", "driveway_factor", "step_penalty", "use_ferry", "use_living_streets", "use_tracks", "use_hills", "use_lit", "service_penalty", "service_factor", "max_hiking_difficulty", "bss_rent_cost", "bss_rent_penalty"]
48
+ __properties: ClassVar[List[str]] = ["walking_speed", "walkway_factor", "sidewalk_factor", "alley_factor", "driveway_factor", "step_penalty", "use_ferry", "use_living_streets", "use_tracks", "use_hills", "use_lit", "service_penalty", "service_factor", "max_hiking_difficulty", "bss_rent_cost", "bss_rent_penalty"]
49
+
50
+ model_config = ConfigDict(
51
+ populate_by_name=True,
52
+ validate_assignment=True,
53
+ protected_namespaces=(),
54
+ )
47
55
 
48
- class Config:
49
- """Pydantic configuration"""
50
- allow_population_by_field_name = True
51
- validate_assignment = True
52
56
 
53
57
  def to_str(self) -> str:
54
58
  """Returns the string representation of the model using alias"""
55
- return pprint.pformat(self.dict(by_alias=True))
59
+ return pprint.pformat(self.model_dump(by_alias=True))
56
60
 
57
61
  def to_json(self) -> str:
58
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
59
64
  return json.dumps(self.to_dict())
60
65
 
61
66
  @classmethod
62
- def from_json(cls, json_str: str) -> PedestrianCostingOptions:
67
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
68
  """Create an instance of PedestrianCostingOptions from a JSON string"""
64
69
  return cls.from_dict(json.loads(json_str))
65
70
 
66
- def to_dict(self):
67
- """Returns the dictionary representation of the model using alias"""
68
- _dict = self.dict(by_alias=True,
69
- exclude={
70
- "additional_properties"
71
- },
72
- 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
+ )
73
91
  # puts key-value pairs in additional_properties in the top level
74
92
  if self.additional_properties is not None:
75
93
  for _key, _value in self.additional_properties.items():
@@ -78,15 +96,15 @@ class PedestrianCostingOptions(BaseModel):
78
96
  return _dict
79
97
 
80
98
  @classmethod
81
- def from_dict(cls, obj: dict) -> PedestrianCostingOptions:
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
100
  """Create an instance of PedestrianCostingOptions from a dict"""
83
101
  if obj is None:
84
102
  return None
85
103
 
86
104
  if not isinstance(obj, dict):
87
- return PedestrianCostingOptions.parse_obj(obj)
105
+ return cls.model_validate(obj)
88
106
 
89
- _obj = PedestrianCostingOptions.parse_obj({
107
+ _obj = cls.model_validate({
90
108
  "walking_speed": obj.get("walking_speed"),
91
109
  "walkway_factor": obj.get("walkway_factor") if obj.get("walkway_factor") is not None else 1,
92
110
  "sidewalk_factor": obj.get("sidewalk_factor") if obj.get("sidewalk_factor") is not None else 1,
@@ -111,3 +129,4 @@ class PedestrianCostingOptions(BaseModel):
111
129
 
112
130
  return _obj
113
131
 
132
+
@@ -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,56 +18,74 @@ 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, StrictFloat, StrictInt, StrictStr, conlist, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing_extensions import Annotated
24
24
  from stadiamaps.models.geo_json_point import GeoJSONPoint
25
25
  from stadiamaps.models.pelias_geo_json_properties import PeliasGeoJSONProperties
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
26
28
 
27
29
  class PeliasGeoJSONFeature(BaseModel):
28
30
  """
29
31
  PeliasGeoJSONFeature
30
- """
31
- type: StrictStr = Field(...)
32
- geometry: GeoJSONPoint = Field(...)
32
+ """ # noqa: E501
33
+ type: StrictStr
34
+ geometry: GeoJSONPoint
33
35
  properties: Optional[PeliasGeoJSONProperties] = None
34
- bbox: Optional[conlist(Union[StrictFloat, StrictInt], max_items=4, min_items=4)] = Field(None, description="An array of 4 floating point numbers representing the (W, S, E, N) extremes of the features found.")
36
+ bbox: Optional[Annotated[List[Union[StrictFloat, StrictInt]], Field(min_length=4, max_length=4)]] = Field(default=None, description="An array of 4 floating point numbers representing the (W, S, E, N) extremes of the features found.")
35
37
  id: Optional[StrictStr] = None
36
38
  additional_properties: Dict[str, Any] = {}
37
- __properties = ["type", "geometry", "properties", "bbox", "id"]
39
+ __properties: ClassVar[List[str]] = ["type", "geometry", "properties", "bbox", "id"]
38
40
 
39
- @validator('type')
41
+ @field_validator('type')
40
42
  def type_validate_enum(cls, value):
41
43
  """Validates the enum"""
42
- if value not in ('Feature'):
44
+ if value not in set(['Feature']):
43
45
  raise ValueError("must be one of enum values ('Feature')")
44
46
  return value
45
47
 
46
- class Config:
47
- """Pydantic configuration"""
48
- allow_population_by_field_name = True
49
- validate_assignment = True
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
50
54
 
51
55
  def to_str(self) -> str:
52
56
  """Returns the string representation of the model using alias"""
53
- return pprint.pformat(self.dict(by_alias=True))
57
+ return pprint.pformat(self.model_dump(by_alias=True))
54
58
 
55
59
  def to_json(self) -> str:
56
60
  """Returns the JSON representation of the model using alias"""
61
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
62
  return json.dumps(self.to_dict())
58
63
 
59
64
  @classmethod
60
- def from_json(cls, json_str: str) -> PeliasGeoJSONFeature:
65
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
66
  """Create an instance of PeliasGeoJSONFeature from a JSON string"""
62
67
  return cls.from_dict(json.loads(json_str))
63
68
 
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)
69
+ def to_dict(self) -> Dict[str, Any]:
70
+ """Return the dictionary representation of the model using alias.
71
+
72
+ This has the following differences from calling pydantic's
73
+ `self.model_dump(by_alias=True)`:
74
+
75
+ * `None` is only added to the output dict for nullable fields that
76
+ were set at model initialization. Other fields with value `None`
77
+ are ignored.
78
+ * Fields in `self.additional_properties` are added to the output dict.
79
+ """
80
+ excluded_fields: Set[str] = set([
81
+ "additional_properties",
82
+ ])
83
+
84
+ _dict = self.model_dump(
85
+ by_alias=True,
86
+ exclude=excluded_fields,
87
+ exclude_none=True,
88
+ )
71
89
  # override the default output from pydantic by calling `to_dict()` of geometry
72
90
  if self.geometry:
73
91
  _dict['geometry'] = self.geometry.to_dict()
@@ -82,18 +100,18 @@ class PeliasGeoJSONFeature(BaseModel):
82
100
  return _dict
83
101
 
84
102
  @classmethod
85
- def from_dict(cls, obj: dict) -> PeliasGeoJSONFeature:
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
104
  """Create an instance of PeliasGeoJSONFeature from a dict"""
87
105
  if obj is None:
88
106
  return None
89
107
 
90
108
  if not isinstance(obj, dict):
91
- return PeliasGeoJSONFeature.parse_obj(obj)
109
+ return cls.model_validate(obj)
92
110
 
93
- _obj = PeliasGeoJSONFeature.parse_obj({
111
+ _obj = cls.model_validate({
94
112
  "type": obj.get("type"),
95
- "geometry": GeoJSONPoint.from_dict(obj.get("geometry")) if obj.get("geometry") is not None else None,
96
- "properties": PeliasGeoJSONProperties.from_dict(obj.get("properties")) if obj.get("properties") is not None else None,
113
+ "geometry": GeoJSONPoint.from_dict(obj["geometry"]) if obj.get("geometry") is not None else None,
114
+ "properties": PeliasGeoJSONProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None,
97
115
  "bbox": obj.get("bbox"),
98
116
  "id": obj.get("id")
99
117
  })
@@ -104,3 +122,4 @@ class PeliasGeoJSONFeature(BaseModel):
104
122
 
105
123
  return _obj
106
124
 
125
+
@@ -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,22 +18,23 @@ 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, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.pelias_geo_json_properties_addendum import PeliasGeoJSONPropertiesAddendum
25
24
  from stadiamaps.models.pelias_layer import PeliasLayer
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
26
27
 
27
28
  class PeliasGeoJSONProperties(BaseModel):
28
29
  """
29
30
  PeliasGeoJSONProperties
30
- """
31
- gid: Optional[StrictStr] = Field(None, description="A scoped GID for this result. This can be passed to the place endpoint. Note that these are not always stable. For OSM, Geonames, and Who's on First, these are usually stable, but for other sources like OSM, no stability is guaranteed.")
32
- source_id: Optional[StrictStr] = Field(None, description="An ID referencing the original data source (specified via source) for the result. These IDs are specific to the source that they originated from. For example, in the case of OSM, these typically look like way/123 or point/123.")
33
- label: Optional[StrictStr] = Field(None, description="A full, human-readable label. However, you may not necessarily want to use this; be sure to read the docs for name, locality, and region before making a decision. This field is mostly localized. The order of components is generally locally correct (ex: for an address in South Korea, the house number appears after the street name). However, components will use a request language equivalent if one exists (ex: Seoul instead of 서울 if lang=en).")
31
+ """ # noqa: E501
32
+ gid: Optional[StrictStr] = Field(default=None, description="A scoped GID for this result. This can be passed to the place endpoint. Note that these are not always stable. For OSM, Geonames, and Who's on First, these are usually stable, but for other sources like OSM, no stability is guaranteed.")
33
+ source_id: Optional[StrictStr] = Field(default=None, description="An ID referencing the original data source (specified via source) for the result. These IDs are specific to the source that they originated from. For example, in the case of OSM, these typically look like way/123 or point/123.")
34
+ label: Optional[StrictStr] = Field(default=None, description="A full, human-readable label. However, you may not necessarily want to use this; be sure to read the docs for name, locality, and region before making a decision. This field is mostly localized. The order of components is generally locally correct (ex: for an address in South Korea, the house number appears after the street name). However, components will use a request language equivalent if one exists (ex: Seoul instead of 서울 if lang=en).")
34
35
  layer: Optional[PeliasLayer] = None
35
- name: Optional[StrictStr] = Field(None, description="The name of the place, the street address including house number, or label of similar relevance. If your app is localized to a specific region, you may get better display results by combining name, locality OR region (or neither?), and postal code together in the local format. Experiment with what works best for your use case.")
36
- accuracy: Optional[StrictStr] = Field(None, description="The accuracy of the geographic coordinates in the result. This value is a property of the result itself and won't change based on the query. A point result means that the record can reasonably be represented by a single geographic point. Addresses, venues, or interpolated addresses usually have point accuracy. Larger areas, such as a city or country, cannot be represented by a single point, so a centroid is given instead.")
36
+ name: Optional[StrictStr] = Field(default=None, description="The name of the place, the street address including house number, or label of similar relevance. If your app is localized to a specific region, you may get better display results by combining name, locality OR region (or neither?), and postal code together in the local format. Experiment with what works best for your use case.")
37
+ accuracy: Optional[StrictStr] = Field(default=None, description="The accuracy of the geographic coordinates in the result. This value is a property of the result itself and won't change based on the query. A point result means that the record can reasonably be represented by a single geographic point. Addresses, venues, or interpolated addresses usually have point accuracy. Larger areas, such as a city or country, cannot be represented by a single point, so a centroid is given instead.")
37
38
  addendum: Optional[PeliasGeoJSONPropertiesAddendum] = None
38
39
  continent: Optional[StrictStr] = None
39
40
  continent_gid: Optional[StrictStr] = None
@@ -46,49 +47,65 @@ class PeliasGeoJSONProperties(BaseModel):
46
47
  postalcode: Optional[StrictStr] = None
47
48
  street: Optional[StrictStr] = None
48
49
  housenumber: Optional[StrictStr] = None
49
- locality: Optional[StrictStr] = Field(None, description="The city, village, town, etc. that the place / address is part of. Note that values may not always match postal or local conventions perfectly.")
50
+ locality: Optional[StrictStr] = Field(default=None, description="The city, village, town, etc. that the place / address is part of. Note that values may not always match postal or local conventions perfectly.")
50
51
  locality_gid: Optional[StrictStr] = None
51
- county: Optional[StrictStr] = Field(None, description="Administrative divisions between localities and regions. Useful for disambiguating nearby results with similar names.")
52
- region: Optional[StrictStr] = Field(None, description="Typically the first administrative division within a country. For example, a US state or a Canadian province.")
53
- region_a: Optional[StrictStr] = Field(None, description="The abbreviation for the region.")
52
+ county: Optional[StrictStr] = Field(default=None, description="Administrative divisions between localities and regions. Useful for disambiguating nearby results with similar names.")
53
+ region: Optional[StrictStr] = Field(default=None, description="Typically the first administrative division within a country. For example, a US state or a Canadian province.")
54
+ region_a: Optional[StrictStr] = Field(default=None, description="The abbreviation for the region.")
54
55
  additional_properties: Dict[str, Any] = {}
55
- __properties = ["gid", "source_id", "label", "layer", "name", "accuracy", "addendum", "continent", "continent_gid", "country", "country_gid", "neighbourhood", "neighbourhood_gid", "borough", "borough_gid", "postalcode", "street", "housenumber", "locality", "locality_gid", "county", "region", "region_a"]
56
+ __properties: ClassVar[List[str]] = ["gid", "source_id", "label", "layer", "name", "accuracy", "addendum", "continent", "continent_gid", "country", "country_gid", "neighbourhood", "neighbourhood_gid", "borough", "borough_gid", "postalcode", "street", "housenumber", "locality", "locality_gid", "county", "region", "region_a"]
56
57
 
57
- @validator('accuracy')
58
+ @field_validator('accuracy')
58
59
  def accuracy_validate_enum(cls, value):
59
60
  """Validates the enum"""
60
61
  if value is None:
61
62
  return value
62
63
 
63
- if value not in ('point', 'centroid'):
64
+ if value not in set(['point', 'centroid']):
64
65
  raise ValueError("must be one of enum values ('point', 'centroid')")
65
66
  return value
66
67
 
67
- class Config:
68
- """Pydantic configuration"""
69
- allow_population_by_field_name = True
70
- validate_assignment = True
68
+ model_config = ConfigDict(
69
+ populate_by_name=True,
70
+ validate_assignment=True,
71
+ protected_namespaces=(),
72
+ )
73
+
71
74
 
72
75
  def to_str(self) -> str:
73
76
  """Returns the string representation of the model using alias"""
74
- return pprint.pformat(self.dict(by_alias=True))
77
+ return pprint.pformat(self.model_dump(by_alias=True))
75
78
 
76
79
  def to_json(self) -> str:
77
80
  """Returns the JSON representation of the model using alias"""
81
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
78
82
  return json.dumps(self.to_dict())
79
83
 
80
84
  @classmethod
81
- def from_json(cls, json_str: str) -> PeliasGeoJSONProperties:
85
+ def from_json(cls, json_str: str) -> Optional[Self]:
82
86
  """Create an instance of PeliasGeoJSONProperties from a JSON string"""
83
87
  return cls.from_dict(json.loads(json_str))
84
88
 
85
- def to_dict(self):
86
- """Returns the dictionary representation of the model using alias"""
87
- _dict = self.dict(by_alias=True,
88
- exclude={
89
- "additional_properties"
90
- },
91
- exclude_none=True)
89
+ def to_dict(self) -> Dict[str, Any]:
90
+ """Return the dictionary representation of the model using alias.
91
+
92
+ This has the following differences from calling pydantic's
93
+ `self.model_dump(by_alias=True)`:
94
+
95
+ * `None` is only added to the output dict for nullable fields that
96
+ were set at model initialization. Other fields with value `None`
97
+ are ignored.
98
+ * Fields in `self.additional_properties` are added to the output dict.
99
+ """
100
+ excluded_fields: Set[str] = set([
101
+ "additional_properties",
102
+ ])
103
+
104
+ _dict = self.model_dump(
105
+ by_alias=True,
106
+ exclude=excluded_fields,
107
+ exclude_none=True,
108
+ )
92
109
  # override the default output from pydantic by calling `to_dict()` of addendum
93
110
  if self.addendum:
94
111
  _dict['addendum'] = self.addendum.to_dict()
@@ -100,22 +117,22 @@ class PeliasGeoJSONProperties(BaseModel):
100
117
  return _dict
101
118
 
102
119
  @classmethod
103
- def from_dict(cls, obj: dict) -> PeliasGeoJSONProperties:
120
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
121
  """Create an instance of PeliasGeoJSONProperties from a dict"""
105
122
  if obj is None:
106
123
  return None
107
124
 
108
125
  if not isinstance(obj, dict):
109
- return PeliasGeoJSONProperties.parse_obj(obj)
126
+ return cls.model_validate(obj)
110
127
 
111
- _obj = PeliasGeoJSONProperties.parse_obj({
128
+ _obj = cls.model_validate({
112
129
  "gid": obj.get("gid"),
113
130
  "source_id": obj.get("source_id"),
114
131
  "label": obj.get("label"),
115
132
  "layer": obj.get("layer"),
116
133
  "name": obj.get("name"),
117
134
  "accuracy": obj.get("accuracy"),
118
- "addendum": PeliasGeoJSONPropertiesAddendum.from_dict(obj.get("addendum")) if obj.get("addendum") is not None else None,
135
+ "addendum": PeliasGeoJSONPropertiesAddendum.from_dict(obj["addendum"]) if obj.get("addendum") is not None else None,
119
136
  "continent": obj.get("continent"),
120
137
  "continent_gid": obj.get("continent_gid"),
121
138
  "country": obj.get("country"),
@@ -140,3 +157,4 @@ class PeliasGeoJSONProperties(BaseModel):
140
157
 
141
158
  return _obj
142
159
 
160
+
@@ -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,44 +18,61 @@ 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
21
+ from pydantic import BaseModel, ConfigDict
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.pelias_geo_json_properties_addendum_osm import PeliasGeoJSONPropertiesAddendumOsm
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
25
26
 
26
27
  class PeliasGeoJSONPropertiesAddendum(BaseModel):
27
28
  """
28
29
  Optional additional information from the underlying data source (ex: OSM). This includes select fields. The most useful fields are mapped in the definition here, but others may be available.
29
- """
30
+ """ # noqa: E501
30
31
  osm: Optional[PeliasGeoJSONPropertiesAddendumOsm] = None
31
32
  additional_properties: Dict[str, Any] = {}
32
- __properties = ["osm"]
33
+ __properties: ClassVar[List[str]] = ["osm"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
33
40
 
34
- class Config:
35
- """Pydantic configuration"""
36
- allow_population_by_field_name = True
37
- validate_assignment = True
38
41
 
39
42
  def to_str(self) -> str:
40
43
  """Returns the string representation of the model using alias"""
41
- return pprint.pformat(self.dict(by_alias=True))
44
+ return pprint.pformat(self.model_dump(by_alias=True))
42
45
 
43
46
  def to_json(self) -> str:
44
47
  """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
45
49
  return json.dumps(self.to_dict())
46
50
 
47
51
  @classmethod
48
- def from_json(cls, json_str: str) -> PeliasGeoJSONPropertiesAddendum:
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
49
53
  """Create an instance of PeliasGeoJSONPropertiesAddendum from a JSON string"""
50
54
  return cls.from_dict(json.loads(json_str))
51
55
 
52
- def to_dict(self):
53
- """Returns the dictionary representation of the model using alias"""
54
- _dict = self.dict(by_alias=True,
55
- exclude={
56
- "additional_properties"
57
- },
58
- exclude_none=True)
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ * Fields in `self.additional_properties` are added to the output dict.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ "additional_properties",
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
59
76
  # override the default output from pydantic by calling `to_dict()` of osm
60
77
  if self.osm:
61
78
  _dict['osm'] = self.osm.to_dict()
@@ -67,16 +84,16 @@ class PeliasGeoJSONPropertiesAddendum(BaseModel):
67
84
  return _dict
68
85
 
69
86
  @classmethod
70
- def from_dict(cls, obj: dict) -> PeliasGeoJSONPropertiesAddendum:
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
71
88
  """Create an instance of PeliasGeoJSONPropertiesAddendum from a dict"""
72
89
  if obj is None:
73
90
  return None
74
91
 
75
92
  if not isinstance(obj, dict):
76
- return PeliasGeoJSONPropertiesAddendum.parse_obj(obj)
93
+ return cls.model_validate(obj)
77
94
 
78
- _obj = PeliasGeoJSONPropertiesAddendum.parse_obj({
79
- "osm": PeliasGeoJSONPropertiesAddendumOsm.from_dict(obj.get("osm")) if obj.get("osm") is not None else None
95
+ _obj = cls.model_validate({
96
+ "osm": PeliasGeoJSONPropertiesAddendumOsm.from_dict(obj["osm"]) if obj.get("osm") is not None else None
80
97
  })
81
98
  # store additional fields in additional_properties
82
99
  for _key in obj.keys():
@@ -85,3 +102,4 @@ class PeliasGeoJSONPropertiesAddendum(BaseModel):
85
102
 
86
103
  return _obj
87
104
 
105
+