stadiamaps 3.2.1__py3-none-any.whl → 5.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. stadiamaps/__init__.py +32 -11
  2. stadiamaps/api/geocoding_api.py +128 -116
  3. stadiamaps/api/geospatial_api.py +7 -3
  4. stadiamaps/api/routing_api.py +33 -19
  5. stadiamaps/api_client.py +21 -5
  6. stadiamaps/configuration.py +156 -40
  7. stadiamaps/exceptions.py +1 -1
  8. stadiamaps/models/__init__.py +31 -10
  9. stadiamaps/models/access.py +1 -1
  10. stadiamaps/models/admin_region.py +1 -1
  11. stadiamaps/models/administrative.py +1 -1
  12. stadiamaps/models/annotation_filters.py +124 -0
  13. stadiamaps/models/auto_costing_options.py +1 -1
  14. stadiamaps/models/base_costing_options.py +1 -1
  15. stadiamaps/models/base_trace_request.py +7 -7
  16. stadiamaps/models/bicycle_costing_options.py +1 -1
  17. stadiamaps/models/bike_network.py +1 -1
  18. stadiamaps/models/bulk_request.py +1 -1
  19. stadiamaps/models/bulk_request_query.py +1 -1
  20. stadiamaps/models/bulk_search_response.py +4 -4
  21. stadiamaps/models/contour.py +1 -1
  22. stadiamaps/models/coordinate.py +1 -1
  23. stadiamaps/models/costing_model.py +1 -1
  24. stadiamaps/models/costing_options.py +1 -1
  25. stadiamaps/models/directions_options.py +4 -4
  26. stadiamaps/models/distance_unit.py +1 -1
  27. stadiamaps/models/edge_sign.py +1 -1
  28. stadiamaps/models/edge_use.py +1 -1
  29. stadiamaps/models/end_node.py +4 -4
  30. stadiamaps/models/extended_directions_options.py +121 -0
  31. stadiamaps/models/geo_attributes.py +1 -1
  32. stadiamaps/models/geo_json_geometry.py +1 -1
  33. stadiamaps/models/geo_json_geometry_base.py +1 -1
  34. stadiamaps/models/geo_json_line_string.py +1 -1
  35. stadiamaps/models/geo_json_point.py +1 -1
  36. stadiamaps/models/geo_json_polygon.py +1 -1
  37. stadiamaps/models/{pelias_response.py → geocode_response.py} +11 -11
  38. stadiamaps/models/{pelias_geo_json_feature.py → geocoding_geo_json_feature.py} +8 -8
  39. stadiamaps/models/{pelias_geo_json_properties.py → geocoding_geo_json_properties.py} +40 -14
  40. stadiamaps/models/{pelias_geo_json_properties_addendum.py → geocoding_geo_json_properties_addendum.py} +7 -7
  41. stadiamaps/models/{pelias_geo_json_properties_addendum_osm.py → geocoding_geo_json_properties_addendum_osm.py} +5 -5
  42. stadiamaps/models/{pelias_layer.py → geocoding_layer.py} +3 -3
  43. stadiamaps/models/geocoding_object.py +1 -1
  44. stadiamaps/models/{pelias_source.py → geocoding_source.py} +4 -3
  45. stadiamaps/models/height_request.py +4 -4
  46. stadiamaps/models/height_response.py +4 -4
  47. stadiamaps/models/highway_classification.py +1 -1
  48. stadiamaps/models/intersecting_edge.py +1 -1
  49. stadiamaps/models/isochrone_costing_model.py +1 -1
  50. stadiamaps/models/isochrone_feature.py +1 -1
  51. stadiamaps/models/isochrone_properties.py +1 -1
  52. stadiamaps/models/isochrone_request.py +7 -7
  53. stadiamaps/models/isochrone_response.py +4 -4
  54. stadiamaps/models/locate_detailed_edge.py +1 -1
  55. stadiamaps/models/locate_edge.py +1 -1
  56. stadiamaps/models/locate_edge_info.py +1 -1
  57. stadiamaps/models/locate_node.py +1 -1
  58. stadiamaps/models/locate_object.py +7 -7
  59. stadiamaps/models/low_speed_vehicle_costing_options.py +1 -1
  60. stadiamaps/models/maneuver_sign.py +13 -13
  61. stadiamaps/models/maneuver_sign_element.py +1 -1
  62. stadiamaps/models/map_match_costing_model.py +1 -1
  63. stadiamaps/models/map_match_request.py +35 -11
  64. stadiamaps/models/map_match_route_response.py +4 -4
  65. stadiamaps/models/map_match_trace_options.py +1 -1
  66. stadiamaps/models/map_match_waypoint.py +1 -1
  67. stadiamaps/models/matched_point.py +1 -1
  68. stadiamaps/models/matrix_costing_model.py +1 -1
  69. stadiamaps/models/matrix_distance.py +1 -1
  70. stadiamaps/models/matrix_request.py +10 -10
  71. stadiamaps/models/matrix_response.py +16 -16
  72. stadiamaps/models/matrix_waypoint.py +1 -1
  73. stadiamaps/models/motor_scooter_costing_options.py +1 -1
  74. stadiamaps/models/motorcycle_costing_options.py +1 -1
  75. stadiamaps/models/nearest_roads_request.py +7 -7
  76. stadiamaps/models/node_id.py +1 -1
  77. stadiamaps/models/node_type.py +1 -1
  78. stadiamaps/models/optimized_route_request.py +35 -11
  79. stadiamaps/models/osrm_admin.py +103 -0
  80. stadiamaps/models/osrm_annotation.py +117 -0
  81. stadiamaps/models/osrm_banner_component.py +113 -0
  82. stadiamaps/models/osrm_banner_content.py +131 -0
  83. stadiamaps/models/osrm_banner_instruction.py +112 -0
  84. stadiamaps/models/osrm_base_api_response.py +112 -0
  85. stadiamaps/models/osrm_guidance_modifier.py +44 -0
  86. stadiamaps/models/osrm_intersection.py +145 -0
  87. stadiamaps/models/osrm_lane.py +111 -0
  88. stadiamaps/models/osrm_route.py +119 -0
  89. stadiamaps/models/osrm_route_leg.py +148 -0
  90. stadiamaps/models/osrm_route_response.py +132 -0
  91. stadiamaps/models/osrm_route_step.py +185 -0
  92. stadiamaps/models/osrm_speed_limit.py +117 -0
  93. stadiamaps/models/osrm_step_maneuver.py +127 -0
  94. stadiamaps/models/osrm_via_waypoint.py +105 -0
  95. stadiamaps/models/osrm_voice_instruction.py +105 -0
  96. stadiamaps/models/osrm_waypoint.py +108 -0
  97. stadiamaps/models/pedestrian_costing_options.py +1 -1
  98. stadiamaps/models/restrictions.py +1 -1
  99. stadiamaps/models/road_class.py +1 -1
  100. stadiamaps/models/route200_response.py +138 -0
  101. stadiamaps/models/route_leg.py +4 -4
  102. stadiamaps/models/route_maneuver.py +1 -1
  103. stadiamaps/models/route_request.py +34 -12
  104. stadiamaps/models/route_response.py +4 -4
  105. stadiamaps/models/route_response_alternates_inner.py +1 -1
  106. stadiamaps/models/route_summary.py +1 -1
  107. stadiamaps/models/route_trip.py +13 -13
  108. stadiamaps/models/{valhalla_languages.py → routing_languages.py} +4 -4
  109. stadiamaps/models/{valhalla_long_units.py → routing_long_units.py} +4 -4
  110. stadiamaps/models/routing_response_waypoint.py +1 -1
  111. stadiamaps/models/routing_waypoint.py +1 -1
  112. stadiamaps/models/routing_waypoint_all_of_search_filter.py +1 -1
  113. stadiamaps/models/search_query.py +6 -6
  114. stadiamaps/models/search_structured_query.py +6 -6
  115. stadiamaps/models/simple_routing_waypoint.py +1 -1
  116. stadiamaps/models/speeds.py +1 -1
  117. stadiamaps/models/trace_attribute_filter_options.py +1 -1
  118. stadiamaps/models/trace_attribute_key.py +1 -1
  119. stadiamaps/models/trace_attributes_base_response.py +10 -10
  120. stadiamaps/models/trace_attributes_request.py +13 -11
  121. stadiamaps/models/trace_attributes_response.py +16 -16
  122. stadiamaps/models/trace_edge.py +2 -2
  123. stadiamaps/models/travel_mode.py +1 -1
  124. stadiamaps/models/traversability.py +1 -1
  125. stadiamaps/models/truck_costing_options.py +1 -1
  126. stadiamaps/models/tz_response.py +1 -1
  127. stadiamaps/models/warning.py +1 -1
  128. stadiamaps/rest.py +2 -2
  129. {stadiamaps-3.2.1.dist-info → stadiamaps-5.0.0.dist-info}/METADATA +14 -6
  130. stadiamaps-5.0.0.dist-info/RECORD +157 -0
  131. {stadiamaps-3.2.1.dist-info → stadiamaps-5.0.0.dist-info}/WHEEL +1 -1
  132. stadiamaps/models/pelias_response_geocoding.py +0 -89
  133. stadiamaps/models/route_response_trip.py +0 -117
  134. stadiamaps/models/trace_attributes_response_all_of.py +0 -96
  135. stadiamaps-3.2.1.dist-info/RECORD +0 -139
  136. {stadiamaps-3.2.1.dist-info → stadiamaps-5.0.0.dist-info}/LICENSE.txt +0 -0
  137. {stadiamaps-3.2.1.dist-info → stadiamaps-5.0.0.dist-info}/top_level.txt +0 -0
@@ -5,7 +5,7 @@
5
5
 
6
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: 6.6.3
8
+ The version of the OpenAPI document: 8.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
@@ -18,14 +18,15 @@ import pprint
18
18
  import re # noqa: F401
19
19
  import json
20
20
 
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
- from typing import Any, ClassVar, Dict, List, Optional
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
23
  from typing_extensions import Annotated
24
+ from stadiamaps.models.annotation_filters import AnnotationFilters
24
25
  from stadiamaps.models.coordinate import Coordinate
25
26
  from stadiamaps.models.costing_options import CostingOptions
26
27
  from stadiamaps.models.distance_unit import DistanceUnit
27
28
  from stadiamaps.models.matrix_costing_model import MatrixCostingModel
28
- from stadiamaps.models.valhalla_languages import ValhallaLanguages
29
+ from stadiamaps.models.routing_languages import RoutingLanguages
29
30
  from typing import Optional, Set
30
31
  from typing_extensions import Self
31
32
 
@@ -34,14 +35,19 @@ class OptimizedRouteRequest(BaseModel):
34
35
  OptimizedRouteRequest
35
36
  """ # noqa: E501
36
37
  units: Optional[DistanceUnit] = DistanceUnit.KM
37
- language: Optional[ValhallaLanguages] = ValhallaLanguages.EN_MINUS_US
38
+ language: Optional[RoutingLanguages] = RoutingLanguages.EN_MINUS_US
38
39
  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.")
40
+ format: Optional[StrictStr] = Field(default=None, description="The output response format. The default JSON format is extremely compact and ideal for web or data-constrained use cases where you want to fetch additional attributes on demand in small chunks. The OSRM format is much richer and is configurable with significantly more info for turn-by-turn navigation use cases.")
41
+ banner_instructions: Optional[StrictBool] = Field(default=None, description="Optionally includes helpful banners with timing information for turn-by-turn navigation. This is only available in the OSRM format.")
42
+ voice_instructions: Optional[StrictBool] = Field(default=None, description="Optionally includes voice instructions with timing information for turn-by-turn navigation. This is only available in the OSRM format.")
43
+ filters: Optional[AnnotationFilters] = None
39
44
  id: Optional[StrictStr] = Field(default=None, description="An identifier to disambiguate requests (echoed by the server).")
40
45
  locations: Annotated[List[Coordinate], Field(min_length=3)] = Field(description="The list of locations. The first and last are assumed to be the start and end points, and all intermediate points are locations that you want to visit along the way.")
41
46
  costing: MatrixCostingModel
42
47
  costing_options: Optional[CostingOptions] = None
48
+ elevation_interval: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.0, description="If greater than zero, attempts to include elevation along the route at regular intervals. The \"native\" internal resolution is 30m, so we recommend you use this when possible. This number is interpreted as either meters or feet depending on the unit parameter. Elevation for route sections containing a bridge or tunnel is interpolated linearly. This doesn't always match the true elevation of the bridge/tunnel, but it prevents sharp artifacts from the surrounding terrain. This functionality is unique to the routing endpoints and is not available via the elevation API. NOTE: This has no effect on the OSRM response format.")
43
49
  additional_properties: Dict[str, Any] = {}
44
- __properties: ClassVar[List[str]] = ["units", "language", "directions_type", "id", "locations", "costing", "costing_options"]
50
+ __properties: ClassVar[List[str]] = ["units", "language", "directions_type", "format", "banner_instructions", "voice_instructions", "filters", "id", "locations", "costing", "costing_options", "elevation_interval"]
45
51
 
46
52
  @field_validator('directions_type')
47
53
  def directions_type_validate_enum(cls, value):
@@ -53,6 +59,16 @@ class OptimizedRouteRequest(BaseModel):
53
59
  raise ValueError("must be one of enum values ('none', 'maneuvers', 'instructions')")
54
60
  return value
55
61
 
62
+ @field_validator('format')
63
+ def format_validate_enum(cls, value):
64
+ """Validates the enum"""
65
+ if value is None:
66
+ return value
67
+
68
+ if value not in set(['json', 'osrm']):
69
+ raise ValueError("must be one of enum values ('json', 'osrm')")
70
+ return value
71
+
56
72
  model_config = ConfigDict(
57
73
  populate_by_name=True,
58
74
  validate_assignment=True,
@@ -94,12 +110,15 @@ class OptimizedRouteRequest(BaseModel):
94
110
  exclude=excluded_fields,
95
111
  exclude_none=True,
96
112
  )
113
+ # override the default output from pydantic by calling `to_dict()` of filters
114
+ if self.filters:
115
+ _dict['filters'] = self.filters.to_dict()
97
116
  # override the default output from pydantic by calling `to_dict()` of each item in locations (list)
98
117
  _items = []
99
118
  if self.locations:
100
- for _item in self.locations:
101
- if _item:
102
- _items.append(_item.to_dict())
119
+ for _item_locations in self.locations:
120
+ if _item_locations:
121
+ _items.append(_item_locations.to_dict())
103
122
  _dict['locations'] = _items
104
123
  # override the default output from pydantic by calling `to_dict()` of costing_options
105
124
  if self.costing_options:
@@ -122,12 +141,17 @@ class OptimizedRouteRequest(BaseModel):
122
141
 
123
142
  _obj = cls.model_validate({
124
143
  "units": obj.get("units") if obj.get("units") is not None else DistanceUnit.KM,
125
- "language": obj.get("language") if obj.get("language") is not None else ValhallaLanguages.EN_MINUS_US,
144
+ "language": obj.get("language") if obj.get("language") is not None else RoutingLanguages.EN_MINUS_US,
126
145
  "directions_type": obj.get("directions_type") if obj.get("directions_type") is not None else 'instructions',
146
+ "format": obj.get("format"),
147
+ "banner_instructions": obj.get("banner_instructions"),
148
+ "voice_instructions": obj.get("voice_instructions"),
149
+ "filters": AnnotationFilters.from_dict(obj["filters"]) if obj.get("filters") is not None else None,
127
150
  "id": obj.get("id"),
128
151
  "locations": [Coordinate.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None,
129
152
  "costing": obj.get("costing"),
130
- "costing_options": CostingOptions.from_dict(obj["costing_options"]) if obj.get("costing_options") is not None else None
153
+ "costing_options": CostingOptions.from_dict(obj["costing_options"]) if obj.get("costing_options") is not None else None,
154
+ "elevation_interval": obj.get("elevation_interval") if obj.get("elevation_interval") is not None else 0.0
131
155
  })
132
156
  # store additional fields in additional_properties
133
157
  for _key in obj.keys():
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Stadia Maps Geospatial APIs
5
+
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
+
8
+ The version of the OpenAPI document: 8.0.0
9
+ Contact: support@stadiamaps.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OsrmAdmin(BaseModel):
27
+ """
28
+ OsrmAdmin
29
+ """ # noqa: E501
30
+ iso_3166_1: Optional[StrictStr] = Field(default=None, description="The ISO 3166-1 two-character code for the admin region.")
31
+ iso_3166_1_alpha3: Optional[StrictStr] = Field(default=None, description="The ISO 3166-1 three-character code for the admin region.")
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["iso_3166_1", "iso_3166_1_alpha3"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
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
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of OsrmAdmin from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
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
+ )
76
+ # puts key-value pairs in additional_properties in the top level
77
+ if self.additional_properties is not None:
78
+ for _key, _value in self.additional_properties.items():
79
+ _dict[_key] = _value
80
+
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of OsrmAdmin from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({
93
+ "iso_3166_1": obj.get("iso_3166_1"),
94
+ "iso_3166_1_alpha3": obj.get("iso_3166_1_alpha3")
95
+ })
96
+ # store additional fields in additional_properties
97
+ for _key in obj.keys():
98
+ if _key not in cls.__properties:
99
+ _obj.additional_properties[_key] = obj.get(_key)
100
+
101
+ return _obj
102
+
103
+
@@ -0,0 +1,117 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Stadia Maps Geospatial APIs
5
+
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
+
8
+ The version of the OpenAPI document: 8.0.0
9
+ Contact: support@stadiamaps.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from stadiamaps.models.osrm_speed_limit import OsrmSpeedLimit
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class OsrmAnnotation(BaseModel):
28
+ """
29
+ OsrmAnnotation
30
+ """ # noqa: E501
31
+ distance: Optional[List[Union[StrictFloat, StrictInt]]] = Field(default=None, description="The distance, in meters, between each pair of coordinates.")
32
+ duration: Optional[List[Union[StrictFloat, StrictInt]]] = Field(default=None, description="The duration between each pair of coordinates, in seconds.")
33
+ weight: Optional[List[StrictInt]] = None
34
+ speed: Optional[List[Union[StrictFloat, StrictInt]]] = Field(default=None, description="The estimated speed of travel between each pair of coordinates in meters/sec.")
35
+ maxspeed: Optional[List[OsrmSpeedLimit]] = None
36
+ additional_properties: Dict[str, Any] = {}
37
+ __properties: ClassVar[List[str]] = ["distance", "duration", "weight", "speed", "maxspeed"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of OsrmAnnotation from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ * Fields in `self.additional_properties` are added to the output dict.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ "additional_properties",
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of each item in maxspeed (list)
81
+ _items = []
82
+ if self.maxspeed:
83
+ for _item_maxspeed in self.maxspeed:
84
+ if _item_maxspeed:
85
+ _items.append(_item_maxspeed.to_dict())
86
+ _dict['maxspeed'] = _items
87
+ # puts key-value pairs in additional_properties in the top level
88
+ if self.additional_properties is not None:
89
+ for _key, _value in self.additional_properties.items():
90
+ _dict[_key] = _value
91
+
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
96
+ """Create an instance of OsrmAnnotation from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return cls.model_validate(obj)
102
+
103
+ _obj = cls.model_validate({
104
+ "distance": obj.get("distance"),
105
+ "duration": obj.get("duration"),
106
+ "weight": obj.get("weight"),
107
+ "speed": obj.get("speed"),
108
+ "maxspeed": [OsrmSpeedLimit.from_dict(_item) for _item in obj["maxspeed"]] if obj.get("maxspeed") is not None else None
109
+ })
110
+ # store additional fields in additional_properties
111
+ for _key in obj.keys():
112
+ if _key not in cls.__properties:
113
+ _obj.additional_properties[_key] = obj.get(_key)
114
+
115
+ return _obj
116
+
117
+
@@ -0,0 +1,113 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Stadia Maps Geospatial APIs
5
+
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
+
8
+ The version of the OpenAPI document: 8.0.0
9
+ Contact: support@stadiamaps.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OsrmBannerComponent(BaseModel):
27
+ """
28
+ OsrmBannerComponent
29
+ """ # noqa: E501
30
+ text: Optional[StrictStr] = None
31
+ type: Optional[StrictStr] = None
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["text", "type"]
34
+
35
+ @field_validator('type')
36
+ def type_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ if value is None:
39
+ return value
40
+
41
+ if value not in set(['text', 'icon', 'delimiter', 'exit-number', 'exit', 'lane']):
42
+ raise ValueError("must be one of enum values ('text', 'icon', 'delimiter', 'exit-number', 'exit', 'lane')")
43
+ return value
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of OsrmBannerComponent from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ * Fields in `self.additional_properties` are added to the output dict.
76
+ """
77
+ excluded_fields: Set[str] = set([
78
+ "additional_properties",
79
+ ])
80
+
81
+ _dict = self.model_dump(
82
+ by_alias=True,
83
+ exclude=excluded_fields,
84
+ exclude_none=True,
85
+ )
86
+ # puts key-value pairs in additional_properties in the top level
87
+ if self.additional_properties is not None:
88
+ for _key, _value in self.additional_properties.items():
89
+ _dict[_key] = _value
90
+
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of OsrmBannerComponent from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate({
103
+ "text": obj.get("text"),
104
+ "type": obj.get("type")
105
+ })
106
+ # store additional fields in additional_properties
107
+ for _key in obj.keys():
108
+ if _key not in cls.__properties:
109
+ _obj.additional_properties[_key] = obj.get(_key)
110
+
111
+ return _obj
112
+
113
+
@@ -0,0 +1,131 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Stadia Maps Geospatial APIs
5
+
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
+
8
+ The version of the OpenAPI document: 8.0.0
9
+ Contact: support@stadiamaps.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from stadiamaps.models.osrm_banner_component import OsrmBannerComponent
24
+ from stadiamaps.models.osrm_guidance_modifier import OsrmGuidanceModifier
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class OsrmBannerContent(BaseModel):
29
+ """
30
+ OsrmBannerContent
31
+ """ # noqa: E501
32
+ text: StrictStr
33
+ type: Optional[StrictStr] = None
34
+ modifier: Optional[OsrmGuidanceModifier] = None
35
+ components: Optional[List[OsrmBannerComponent]] = Field(default=None, description="A list of objects with additional context that allow for visual layout improvements beyond what's possible with plain text.")
36
+ additional_properties: Dict[str, Any] = {}
37
+ __properties: ClassVar[List[str]] = ["text", "type", "modifier", "components"]
38
+
39
+ @field_validator('type')
40
+ def type_validate_enum(cls, value):
41
+ """Validates the enum"""
42
+ if value is None:
43
+ return value
44
+
45
+ if value not in set(['turn', 'new name', 'depart', 'arrive', 'merge', 'on ramp', 'off ramp', 'fork', 'end of road', 'continue', 'roundabout', 'rotary', 'roundabout turn', 'notification', 'exit roundabout', 'exit rotary']):
46
+ raise ValueError("must be one of enum values ('turn', 'new name', 'depart', 'arrive', 'merge', 'on ramp', 'off ramp', 'fork', 'end of road', 'continue', 'roundabout', 'rotary', 'roundabout turn', 'notification', 'exit roundabout', 'exit rotary')")
47
+ return value
48
+
49
+ model_config = ConfigDict(
50
+ populate_by_name=True,
51
+ validate_assignment=True,
52
+ protected_namespaces=(),
53
+ )
54
+
55
+
56
+ def to_str(self) -> str:
57
+ """Returns the string representation of the model using alias"""
58
+ return pprint.pformat(self.model_dump(by_alias=True))
59
+
60
+ def to_json(self) -> str:
61
+ """Returns the JSON representation of the model using alias"""
62
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
63
+ return json.dumps(self.to_dict())
64
+
65
+ @classmethod
66
+ def from_json(cls, json_str: str) -> Optional[Self]:
67
+ """Create an instance of OsrmBannerContent from a JSON string"""
68
+ return cls.from_dict(json.loads(json_str))
69
+
70
+ def to_dict(self) -> Dict[str, Any]:
71
+ """Return the dictionary representation of the model using alias.
72
+
73
+ This has the following differences from calling pydantic's
74
+ `self.model_dump(by_alias=True)`:
75
+
76
+ * `None` is only added to the output dict for nullable fields that
77
+ were set at model initialization. Other fields with value `None`
78
+ are ignored.
79
+ * Fields in `self.additional_properties` are added to the output dict.
80
+ """
81
+ excluded_fields: Set[str] = set([
82
+ "additional_properties",
83
+ ])
84
+
85
+ _dict = self.model_dump(
86
+ by_alias=True,
87
+ exclude=excluded_fields,
88
+ exclude_none=True,
89
+ )
90
+ # override the default output from pydantic by calling `to_dict()` of each item in components (list)
91
+ _items = []
92
+ if self.components:
93
+ for _item_components in self.components:
94
+ if _item_components:
95
+ _items.append(_item_components.to_dict())
96
+ _dict['components'] = _items
97
+ # puts key-value pairs in additional_properties in the top level
98
+ if self.additional_properties is not None:
99
+ for _key, _value in self.additional_properties.items():
100
+ _dict[_key] = _value
101
+
102
+ # set to None if modifier (nullable) is None
103
+ # and model_fields_set contains the field
104
+ if self.modifier is None and "modifier" in self.model_fields_set:
105
+ _dict['modifier'] = None
106
+
107
+ return _dict
108
+
109
+ @classmethod
110
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
111
+ """Create an instance of OsrmBannerContent from a dict"""
112
+ if obj is None:
113
+ return None
114
+
115
+ if not isinstance(obj, dict):
116
+ return cls.model_validate(obj)
117
+
118
+ _obj = cls.model_validate({
119
+ "text": obj.get("text"),
120
+ "type": obj.get("type"),
121
+ "modifier": obj.get("modifier"),
122
+ "components": [OsrmBannerComponent.from_dict(_item) for _item in obj["components"]] if obj.get("components") is not None else None
123
+ })
124
+ # store additional fields in additional_properties
125
+ for _key in obj.keys():
126
+ if _key not in cls.__properties:
127
+ _obj.additional_properties[_key] = obj.get(_key)
128
+
129
+ return _obj
130
+
131
+
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Stadia Maps Geospatial APIs
5
+
6
+ The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
7
+
8
+ The version of the OpenAPI document: 8.0.0
9
+ Contact: support@stadiamaps.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from stadiamaps.models.osrm_banner_content import OsrmBannerContent
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class OsrmBannerInstruction(BaseModel):
28
+ """
29
+ OsrmBannerInstruction
30
+ """ # noqa: E501
31
+ distance_along_geometry: Union[StrictFloat, StrictInt] = Field(description="How far (in meters) from the upcoming maneuver the instruction should start being displayed.", alias="distanceAlongGeometry")
32
+ primary: OsrmBannerContent
33
+ secondary: Optional[OsrmBannerContent] = None
34
+ additional_properties: Dict[str, Any] = {}
35
+ __properties: ClassVar[List[str]] = ["distanceAlongGeometry", "primary", "secondary"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of OsrmBannerInstruction from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ * Fields in `self.additional_properties` are added to the output dict.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ "additional_properties",
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of primary
79
+ if self.primary:
80
+ _dict['primary'] = self.primary.to_dict()
81
+ # override the default output from pydantic by calling `to_dict()` of secondary
82
+ if self.secondary:
83
+ _dict['secondary'] = self.secondary.to_dict()
84
+ # puts key-value pairs in additional_properties in the top level
85
+ if self.additional_properties is not None:
86
+ for _key, _value in self.additional_properties.items():
87
+ _dict[_key] = _value
88
+
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of OsrmBannerInstruction from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate({
101
+ "distanceAlongGeometry": obj.get("distanceAlongGeometry"),
102
+ "primary": OsrmBannerContent.from_dict(obj["primary"]) if obj.get("primary") is not None else None,
103
+ "secondary": OsrmBannerContent.from_dict(obj["secondary"]) if obj.get("secondary") is not None else None
104
+ })
105
+ # store additional fields in additional_properties
106
+ for _key in obj.keys():
107
+ if _key not in cls.__properties:
108
+ _obj.additional_properties[_key] = obj.get(_key)
109
+
110
+ return _obj
111
+
112
+