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,52 +18,70 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import List
23
- from pydantic import BaseModel, Field, StrictStr, conlist, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing_extensions import Annotated
24
24
  from stadiamaps.models.trace_attribute_key import TraceAttributeKey
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
25
27
 
26
28
  class TraceAttributeFilterOptions(BaseModel):
27
29
  """
28
30
  TraceAttributeFilterOptions
29
- """
30
- attributes: conlist(TraceAttributeKey, min_items=1) = Field(...)
31
- action: StrictStr = Field(..., description="Determines whether the list of attributes will be used as a whitelist or a blacklist.")
31
+ """ # noqa: E501
32
+ attributes: Annotated[List[TraceAttributeKey], Field(min_length=1)]
33
+ action: StrictStr = Field(description="Determines whether the list of attributes will be used as a whitelist or a blacklist.")
32
34
  additional_properties: Dict[str, Any] = {}
33
- __properties = ["attributes", "action"]
35
+ __properties: ClassVar[List[str]] = ["attributes", "action"]
34
36
 
35
- @validator('action')
37
+ @field_validator('action')
36
38
  def action_validate_enum(cls, value):
37
39
  """Validates the enum"""
38
- if value not in ('include', 'exclude'):
40
+ if value not in set(['include', 'exclude']):
39
41
  raise ValueError("must be one of enum values ('include', 'exclude')")
40
42
  return value
41
43
 
42
- class Config:
43
- """Pydantic configuration"""
44
- allow_population_by_field_name = True
45
- validate_assignment = True
44
+ model_config = ConfigDict(
45
+ populate_by_name=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
46
50
 
47
51
  def to_str(self) -> str:
48
52
  """Returns the string representation of the model using alias"""
49
- return pprint.pformat(self.dict(by_alias=True))
53
+ return pprint.pformat(self.model_dump(by_alias=True))
50
54
 
51
55
  def to_json(self) -> str:
52
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
53
58
  return json.dumps(self.to_dict())
54
59
 
55
60
  @classmethod
56
- def from_json(cls, json_str: str) -> TraceAttributeFilterOptions:
61
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
62
  """Create an instance of TraceAttributeFilterOptions from a JSON string"""
58
63
  return cls.from_dict(json.loads(json_str))
59
64
 
60
- def to_dict(self):
61
- """Returns the dictionary representation of the model using alias"""
62
- _dict = self.dict(by_alias=True,
63
- exclude={
64
- "additional_properties"
65
- },
66
- 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
+ )
67
85
  # puts key-value pairs in additional_properties in the top level
68
86
  if self.additional_properties is not None:
69
87
  for _key, _value in self.additional_properties.items():
@@ -72,15 +90,15 @@ class TraceAttributeFilterOptions(BaseModel):
72
90
  return _dict
73
91
 
74
92
  @classmethod
75
- def from_dict(cls, obj: dict) -> TraceAttributeFilterOptions:
93
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
94
  """Create an instance of TraceAttributeFilterOptions from a dict"""
77
95
  if obj is None:
78
96
  return None
79
97
 
80
98
  if not isinstance(obj, dict):
81
- return TraceAttributeFilterOptions.parse_obj(obj)
99
+ return cls.model_validate(obj)
82
100
 
83
- _obj = TraceAttributeFilterOptions.parse_obj({
101
+ _obj = cls.model_validate({
84
102
  "attributes": obj.get("attributes"),
85
103
  "action": obj.get("action")
86
104
  })
@@ -91,3 +109,4 @@ class TraceAttributeFilterOptions(BaseModel):
91
109
 
92
110
  return _obj
93
111
 
112
+
@@ -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 TraceAttributeKey(str, Enum):
@@ -100,8 +97,8 @@ class TraceAttributeKey(str, Enum):
100
97
  MATCHED_DOT_DISTANCE_FROM_TRACE_POINT = 'matched.distance_from_trace_point'
101
98
 
102
99
  @classmethod
103
- def from_json(cls, json_str: str) -> TraceAttributeKey:
100
+ def from_json(cls, json_str: str) -> Self:
104
101
  """Create an instance of TraceAttributeKey from a JSON string"""
105
- return TraceAttributeKey(json.loads(json_str))
102
+ return cls(json.loads(json_str))
106
103
 
107
104
 
@@ -3,14 +3,14 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
7
 
8
- The version of the OpenAPI document: 5.0.6
8
+ The version of the OpenAPI document: 6.1.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,51 +18,69 @@ 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, StrictInt, StrictStr, confloat, conint, conlist
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing_extensions import Annotated
24
24
  from stadiamaps.models.admin_region import AdminRegion
25
25
  from stadiamaps.models.matched_point import MatchedPoint
26
26
  from stadiamaps.models.trace_edge import TraceEdge
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
27
29
 
28
30
  class TraceAttributesBaseResponse(BaseModel):
29
31
  """
30
32
  TraceAttributesBaseResponse
31
- """
32
- edges: Optional[conlist(TraceEdge)] = Field(None, description="The list of edges matched along the path.")
33
- admins: Optional[conlist(AdminRegion)] = Field(None, description="The set of administrative regions matched along the path. Rather than repeating this information for every end node, the admins in this list are referenced by index.")
34
- matched_points: Optional[conlist(MatchedPoint)] = Field(None, description="List of match results when using the map_snap shape match algorithm. There is a one-to-one correspondence with the input set of latitude, longitude coordinates and this list of match results.")
33
+ """ # noqa: E501
34
+ edges: Optional[List[TraceEdge]] = Field(default=None, description="The list of edges matched along the path.")
35
+ admins: Optional[List[AdminRegion]] = Field(default=None, description="The set of administrative regions matched along the path. Rather than repeating this information for every end node, the admins in this list are referenced by index.")
36
+ matched_points: Optional[List[MatchedPoint]] = Field(default=None, description="List of match results when using the map_snap shape match algorithm. There is a one-to-one correspondence with the input set of latitude, longitude coordinates and this list of match results.")
35
37
  osm_changeset: Optional[StrictInt] = None
36
- shape: Optional[StrictStr] = Field(None, description="The encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm) of the matched path.")
37
- confidence_score: Optional[Union[confloat(le=1, ge=0, strict=True), conint(le=1, ge=0, strict=True)]] = None
38
+ shape: Optional[StrictStr] = Field(default=None, description="The encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm) of the matched path.")
39
+ confidence_score: Optional[Union[Annotated[float, Field(le=1, strict=True, ge=0)], Annotated[int, Field(le=1, strict=True, ge=0)]]] = None
38
40
  additional_properties: Dict[str, Any] = {}
39
- __properties = ["edges", "admins", "matched_points", "osm_changeset", "shape", "confidence_score"]
41
+ __properties: ClassVar[List[str]] = ["edges", "admins", "matched_points", "osm_changeset", "shape", "confidence_score"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
40
48
 
41
- class Config:
42
- """Pydantic configuration"""
43
- allow_population_by_field_name = True
44
- validate_assignment = True
45
49
 
46
50
  def to_str(self) -> str:
47
51
  """Returns the string representation of the model using alias"""
48
- return pprint.pformat(self.dict(by_alias=True))
52
+ return pprint.pformat(self.model_dump(by_alias=True))
49
53
 
50
54
  def to_json(self) -> str:
51
55
  """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
57
  return json.dumps(self.to_dict())
53
58
 
54
59
  @classmethod
55
- def from_json(cls, json_str: str) -> TraceAttributesBaseResponse:
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
61
  """Create an instance of TraceAttributesBaseResponse from a JSON string"""
57
62
  return cls.from_dict(json.loads(json_str))
58
63
 
59
- def to_dict(self):
60
- """Returns the dictionary representation of the model using alias"""
61
- _dict = self.dict(by_alias=True,
62
- exclude={
63
- "additional_properties"
64
- },
65
- exclude_none=True)
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ * Fields in `self.additional_properties` are added to the output dict.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ "additional_properties",
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
66
84
  # override the default output from pydantic by calling `to_dict()` of each item in edges (list)
67
85
  _items = []
68
86
  if self.edges:
@@ -92,18 +110,18 @@ class TraceAttributesBaseResponse(BaseModel):
92
110
  return _dict
93
111
 
94
112
  @classmethod
95
- def from_dict(cls, obj: dict) -> TraceAttributesBaseResponse:
113
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
114
  """Create an instance of TraceAttributesBaseResponse from a dict"""
97
115
  if obj is None:
98
116
  return None
99
117
 
100
118
  if not isinstance(obj, dict):
101
- return TraceAttributesBaseResponse.parse_obj(obj)
119
+ return cls.model_validate(obj)
102
120
 
103
- _obj = TraceAttributesBaseResponse.parse_obj({
104
- "edges": [TraceEdge.from_dict(_item) for _item in obj.get("edges")] if obj.get("edges") is not None else None,
105
- "admins": [AdminRegion.from_dict(_item) for _item in obj.get("admins")] if obj.get("admins") is not None else None,
106
- "matched_points": [MatchedPoint.from_dict(_item) for _item in obj.get("matched_points")] if obj.get("matched_points") is not None else None,
121
+ _obj = cls.model_validate({
122
+ "edges": [TraceEdge.from_dict(_item) for _item in obj["edges"]] if obj.get("edges") is not None else None,
123
+ "admins": [AdminRegion.from_dict(_item) for _item in obj["admins"]] if obj.get("admins") is not None else None,
124
+ "matched_points": [MatchedPoint.from_dict(_item) for _item in obj["matched_points"]] if obj.get("matched_points") is not None else None,
107
125
  "osm_changeset": obj.get("osm_changeset"),
108
126
  "shape": obj.get("shape"),
109
127
  "confidence_score": obj.get("confidence_score")
@@ -115,3 +133,4 @@ class TraceAttributesBaseResponse(BaseModel):
115
133
 
116
134
  return _obj
117
135
 
136
+
@@ -3,14 +3,14 @@
3
3
  """
4
4
  Stadia Maps Geospatial APIs
5
5
 
6
- The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications. # noqa: E501
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
7
 
8
- The version of the OpenAPI document: 5.0.6
8
+ The version of the OpenAPI document: 6.1.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
13
- """
13
+ """ # noqa: E501
14
14
 
15
15
 
16
16
  from __future__ import annotations
@@ -18,65 +18,95 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
-
22
- from typing import List, Optional
23
- from pydantic import BaseModel, Field, StrictStr, conlist, validator
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
24
23
  from stadiamaps.models.costing_options import CostingOptions
25
- from stadiamaps.models.directions_options import DirectionsOptions
24
+ from stadiamaps.models.distance_unit import DistanceUnit
26
25
  from stadiamaps.models.map_match_costing_model import MapMatchCostingModel
27
26
  from stadiamaps.models.map_match_waypoint import MapMatchWaypoint
28
- from stadiamaps.models.trace_attributes_request_all_of_filters import TraceAttributesRequestAllOfFilters
27
+ from stadiamaps.models.trace_attribute_filter_options import TraceAttributeFilterOptions
28
+ from stadiamaps.models.valhalla_languages import ValhallaLanguages
29
+ from typing import Optional, Set
30
+ from typing_extensions import Self
29
31
 
30
32
  class TraceAttributesRequest(BaseModel):
31
33
  """
32
34
  TraceAttributesRequest
33
- """
34
- id: Optional[StrictStr] = Field(None, description="An identifier to disambiguate requests (echoed by the server).")
35
- shape: Optional[conlist(MapMatchWaypoint)] = Field(None, description="REQUIRED if `encoded_polyline` is not present. Note that `break` type locations are only supported when `shape_match` is set to `map_match`.")
36
- encoded_polyline: Optional[StrictStr] = Field(None, description="REQUIRED if `shape` is not present. An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline must be encoded with 6 digits of precision rather than the usual 5.")
37
- costing: MapMatchCostingModel = Field(...)
35
+ """ # noqa: E501
36
+ id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
37
+ shape: Optional[List[MapMatchWaypoint]] = Field(default=None, description="REQUIRED if `encoded_polyline` is not present. Note that `break` type locations are only supported when `shape_match` is set to `map_match`.")
38
+ encoded_polyline: Optional[StrictStr] = Field(default=None, description="REQUIRED if `shape` is not present. An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline must be encoded with 6 digits of precision rather than the usual 5.")
39
+ costing: MapMatchCostingModel
38
40
  costing_options: Optional[CostingOptions] = None
39
- shape_match: Optional[StrictStr] = Field(None, description="Three snapping modes provide some control over how the map matching occurs. `edge_walk` is fast, but requires extremely precise data that matches the route graph almost perfectly. `map_snap` can handle significantly noisier data, but is very expensive. `walk_or_snap`, the default, tries to use edge walking first and falls back to map matching if edge walking fails. In general, you should not need to change this parameter unless you want to trace a multi-leg route with multiple `break` locations in the `shape`.")
40
- directions_options: Optional[DirectionsOptions] = None
41
- filters: Optional[TraceAttributesRequestAllOfFilters] = None
41
+ shape_match: Optional[StrictStr] = Field(default=None, description="Three snapping modes provide some control over how the map matching occurs. `edge_walk` is fast, but requires extremely precise data that matches the route graph almost perfectly. `map_snap` can handle significantly noisier data, but is very expensive. `walk_or_snap`, the default, tries to use edge walking first and falls back to map matching if edge walking fails. In general, you should not need to change this parameter unless you want to trace a multi-leg route with multiple `break` locations in the `shape`.")
42
+ units: Optional[DistanceUnit] = None
43
+ language: Optional[ValhallaLanguages] = None
44
+ directions_type: Optional[StrictStr] = Field(default='instructions', description="The level of directional narrative to include. Locations and times will always be returned, but narrative generation verbosity can be controlled with this parameter.")
45
+ filters: Optional[TraceAttributeFilterOptions] = Field(default=None, description="If present, provides either a whitelist or a blacklist of keys to include/exclude in the response. This key is optional, and if omitted from the request, all available info will be returned.")
42
46
  additional_properties: Dict[str, Any] = {}
43
- __properties = ["id", "shape", "encoded_polyline", "costing", "costing_options", "shape_match", "directions_options", "filters"]
47
+ __properties: ClassVar[List[str]] = ["id", "shape", "encoded_polyline", "costing", "costing_options", "shape_match", "units", "language", "directions_type", "filters"]
44
48
 
45
- @validator('shape_match')
49
+ @field_validator('shape_match')
46
50
  def shape_match_validate_enum(cls, value):
47
51
  """Validates the enum"""
48
52
  if value is None:
49
53
  return value
50
54
 
51
- if value not in ('edge_walk', 'map_snap', 'walk_or_snap'):
55
+ if value not in set(['edge_walk', 'map_snap', 'walk_or_snap']):
52
56
  raise ValueError("must be one of enum values ('edge_walk', 'map_snap', 'walk_or_snap')")
53
57
  return value
54
58
 
55
- class Config:
56
- """Pydantic configuration"""
57
- allow_population_by_field_name = True
58
- validate_assignment = True
59
+ @field_validator('directions_type')
60
+ def directions_type_validate_enum(cls, value):
61
+ """Validates the enum"""
62
+ if value is None:
63
+ return value
64
+
65
+ if value not in set(['none', 'maneuvers', 'instructions']):
66
+ raise ValueError("must be one of enum values ('none', 'maneuvers', 'instructions')")
67
+ return value
68
+
69
+ model_config = ConfigDict(
70
+ populate_by_name=True,
71
+ validate_assignment=True,
72
+ protected_namespaces=(),
73
+ )
74
+
59
75
 
60
76
  def to_str(self) -> str:
61
77
  """Returns the string representation of the model using alias"""
62
- return pprint.pformat(self.dict(by_alias=True))
78
+ return pprint.pformat(self.model_dump(by_alias=True))
63
79
 
64
80
  def to_json(self) -> str:
65
81
  """Returns the JSON representation of the model using alias"""
82
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
83
  return json.dumps(self.to_dict())
67
84
 
68
85
  @classmethod
69
- def from_json(cls, json_str: str) -> TraceAttributesRequest:
86
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
87
  """Create an instance of TraceAttributesRequest from a JSON string"""
71
88
  return cls.from_dict(json.loads(json_str))
72
89
 
73
- def to_dict(self):
74
- """Returns the dictionary representation of the model using alias"""
75
- _dict = self.dict(by_alias=True,
76
- exclude={
77
- "additional_properties"
78
- },
79
- exclude_none=True)
90
+ def to_dict(self) -> Dict[str, Any]:
91
+ """Return the dictionary representation of the model using alias.
92
+
93
+ This has the following differences from calling pydantic's
94
+ `self.model_dump(by_alias=True)`:
95
+
96
+ * `None` is only added to the output dict for nullable fields that
97
+ were set at model initialization. Other fields with value `None`
98
+ are ignored.
99
+ * Fields in `self.additional_properties` are added to the output dict.
100
+ """
101
+ excluded_fields: Set[str] = set([
102
+ "additional_properties",
103
+ ])
104
+
105
+ _dict = self.model_dump(
106
+ by_alias=True,
107
+ exclude=excluded_fields,
108
+ exclude_none=True,
109
+ )
80
110
  # override the default output from pydantic by calling `to_dict()` of each item in shape (list)
81
111
  _items = []
82
112
  if self.shape:
@@ -87,9 +117,6 @@ class TraceAttributesRequest(BaseModel):
87
117
  # override the default output from pydantic by calling `to_dict()` of costing_options
88
118
  if self.costing_options:
89
119
  _dict['costing_options'] = self.costing_options.to_dict()
90
- # override the default output from pydantic by calling `to_dict()` of directions_options
91
- if self.directions_options:
92
- _dict['directions_options'] = self.directions_options.to_dict()
93
120
  # override the default output from pydantic by calling `to_dict()` of filters
94
121
  if self.filters:
95
122
  _dict['filters'] = self.filters.to_dict()
@@ -101,23 +128,25 @@ class TraceAttributesRequest(BaseModel):
101
128
  return _dict
102
129
 
103
130
  @classmethod
104
- def from_dict(cls, obj: dict) -> TraceAttributesRequest:
131
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
105
132
  """Create an instance of TraceAttributesRequest from a dict"""
106
133
  if obj is None:
107
134
  return None
108
135
 
109
136
  if not isinstance(obj, dict):
110
- return TraceAttributesRequest.parse_obj(obj)
137
+ return cls.model_validate(obj)
111
138
 
112
- _obj = TraceAttributesRequest.parse_obj({
139
+ _obj = cls.model_validate({
113
140
  "id": obj.get("id"),
114
- "shape": [MapMatchWaypoint.from_dict(_item) for _item in obj.get("shape")] if obj.get("shape") is not None else None,
141
+ "shape": [MapMatchWaypoint.from_dict(_item) for _item in obj["shape"]] if obj.get("shape") is not None else None,
115
142
  "encoded_polyline": obj.get("encoded_polyline"),
116
143
  "costing": obj.get("costing"),
117
- "costing_options": CostingOptions.from_dict(obj.get("costing_options")) if obj.get("costing_options") is not None else None,
144
+ "costing_options": CostingOptions.from_dict(obj["costing_options"]) if obj.get("costing_options") is not None else None,
118
145
  "shape_match": obj.get("shape_match"),
119
- "directions_options": DirectionsOptions.from_dict(obj.get("directions_options")) if obj.get("directions_options") is not None else None,
120
- "filters": TraceAttributesRequestAllOfFilters.from_dict(obj.get("filters")) if obj.get("filters") is not None else None
146
+ "units": obj.get("units"),
147
+ "language": obj.get("language"),
148
+ "directions_type": obj.get("directions_type") if obj.get("directions_type") is not None else 'instructions',
149
+ "filters": TraceAttributeFilterOptions.from_dict(obj["filters"]) if obj.get("filters") is not None else None
121
150
  })
122
151
  # store additional fields in additional_properties
123
152
  for _key in obj.keys():
@@ -126,3 +155,4 @@ class TraceAttributesRequest(BaseModel):
126
155
 
127
156
  return _obj
128
157
 
158
+
@@ -27,7 +27,7 @@ class TraceAttributesRequestAllOfFilters(BaseModel):
27
27
  """
28
28
  If present, provides either a whitelist or a blacklist of keys to include/exclude in the response. This key is optional, and if omitted from the request, all available info will be returned.
29
29
  """
30
- attributes: conlist(TraceAttributeKey, min_items=1) = Field(...)
30
+ attributes: conlist(TraceAttributeKey, min_length=1) = Field(...)
31
31
  action: StrictStr = Field(..., description="Determines whether the list of attributes will be used as a whitelist or a blacklist.")
32
32
  additional_properties: Dict[str, Any] = {}
33
33
  __properties = ["attributes", "action"]