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
@@ -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, 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 OsrmBaseApiResponse(BaseModel):
27
+ """
28
+ OsrmBaseApiResponse
29
+ """ # noqa: E501
30
+ code: StrictStr
31
+ message: Optional[StrictStr] = None
32
+ data_version: Optional[StrictStr] = None
33
+ additional_properties: Dict[str, Any] = {}
34
+ __properties: ClassVar[List[str]] = ["code", "message", "data_version"]
35
+
36
+ @field_validator('code')
37
+ def code_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value not in set(['Ok', 'InvalidUrl', 'InvalidService', 'InvalidVersion', 'InvalidOptions', 'InvalidQuery', 'InvalidValue', 'NoSegment', 'TooBig', 'NoRoute', 'NoTable', 'NotImplemented', 'NoTrips']):
40
+ raise ValueError("must be one of enum values ('Ok', 'InvalidUrl', 'InvalidService', 'InvalidVersion', 'InvalidOptions', 'InvalidQuery', 'InvalidValue', 'NoSegment', 'TooBig', 'NoRoute', 'NoTable', 'NotImplemented', 'NoTrips')")
41
+ return value
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
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
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of OsrmBaseApiResponse from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
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
+ )
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 OsrmBaseApiResponse 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
+ "code": obj.get("code"),
102
+ "message": obj.get("message"),
103
+ "data_version": obj.get("data_version")
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
+
@@ -0,0 +1,44 @@
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 json
18
+ from enum import Enum
19
+ from typing_extensions import Self
20
+
21
+
22
+ class OsrmGuidanceModifier(str, Enum):
23
+ """
24
+ An optional value indicating the directional change of the maneuver (further clarifying type).
25
+ """
26
+
27
+ """
28
+ allowed enum values
29
+ """
30
+ UTURN = 'uturn'
31
+ SHARP_RIGHT = 'sharp right'
32
+ RIGHT = 'right'
33
+ SLIGHT_RIGHT = 'slight right'
34
+ STRAIGHT = 'straight'
35
+ SLIGHT_LEFT = 'slight left'
36
+ LEFT = 'left'
37
+ SHARP_LEFT = 'sharp left'
38
+
39
+ @classmethod
40
+ def from_json(cls, json_str: str) -> Self:
41
+ """Create an instance of OsrmGuidanceModifier from a JSON string"""
42
+ return cls(json.loads(json_str))
43
+
44
+
@@ -0,0 +1,145 @@
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, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from typing_extensions import Annotated
24
+ from stadiamaps.models.osrm_lane import OsrmLane
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class OsrmIntersection(BaseModel):
29
+ """
30
+ Detailed information about intersections that the route traverses. For every step, the first intersection is at the location of the maneuver. Additional intersections will be provided for every road or path traversed until the next step.
31
+ """ # noqa: E501
32
+ location: Annotated[List[Union[StrictFloat, StrictInt]], Field(min_length=2, max_length=2)] = Field(description="A (longitude, latitude) coordinate pair.")
33
+ bearings: List[StrictInt] = Field(description="A list of bearing values that are available for travel through the intersection.")
34
+ classes: Optional[List[StrictStr]] = None
35
+ entry: List[StrictBool] = Field(description="A list of entry flags, which map 1:1 to the bearings. A value of true indicates that the respective road could be entered on a valid route. False indicates that the turn onto the respective road would violate a restriction.")
36
+ var_in: Optional[StrictInt] = Field(default=None, description="An index into bearings/entry array. Used to calculate the bearing just before the turn. Namely, the clockwise angle from true north to the direction of travel immediately before the maneuver/passing the intersection. Bearings are given relative to the intersection. To get the bearing in the direction of driving, the bearing has to be rotated by a value of 180. The value is not supplied for depart maneuvers.", alias="in")
37
+ out: Optional[StrictInt] = Field(default=None, description="An index into bearings/entry array. Used to calculate the bearing just after the turn. Namely, the clockwise angle from true north to the direction of travel immediately after the maneuver/passing the intersection. This is not supplied for arrive maneuvers.")
38
+ lanes: Optional[List[OsrmLane]] = Field(default=None, description="Available turn lanes at the intersection. May be omitted if no lane information is available for the intersection.")
39
+ admin_index: Optional[StrictInt] = Field(default=None, description="The index into the admin boundaries list on the route leg.")
40
+ duration: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The estimated duration, in seconds, to traverse the intersection.")
41
+ turn_duration: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The estimated duration, in seconds, to complete the turn.")
42
+ turn_weight: Optional[Union[StrictFloat, StrictInt]] = None
43
+ geometry_index: Optional[StrictInt] = Field(default=None, description="The index of the intersection in the leg geometry.")
44
+ weight: Optional[Union[StrictFloat, StrictInt]] = None
45
+ additional_properties: Dict[str, Any] = {}
46
+ __properties: ClassVar[List[str]] = ["location", "bearings", "classes", "entry", "in", "out", "lanes", "admin_index", "duration", "turn_duration", "turn_weight", "geometry_index", "weight"]
47
+
48
+ @field_validator('classes')
49
+ def classes_validate_enum(cls, value):
50
+ """Validates the enum"""
51
+ if value is None:
52
+ return value
53
+
54
+ for i in value:
55
+ if i not in set(['toll', 'ferry', 'restricted', 'motorway', 'tunnel']):
56
+ raise ValueError("each list item must be one of ('toll', 'ferry', 'restricted', 'motorway', 'tunnel')")
57
+ return value
58
+
59
+ model_config = ConfigDict(
60
+ populate_by_name=True,
61
+ validate_assignment=True,
62
+ protected_namespaces=(),
63
+ )
64
+
65
+
66
+ def to_str(self) -> str:
67
+ """Returns the string representation of the model using alias"""
68
+ return pprint.pformat(self.model_dump(by_alias=True))
69
+
70
+ def to_json(self) -> str:
71
+ """Returns the JSON representation of the model using alias"""
72
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
73
+ return json.dumps(self.to_dict())
74
+
75
+ @classmethod
76
+ def from_json(cls, json_str: str) -> Optional[Self]:
77
+ """Create an instance of OsrmIntersection from a JSON string"""
78
+ return cls.from_dict(json.loads(json_str))
79
+
80
+ def to_dict(self) -> Dict[str, Any]:
81
+ """Return the dictionary representation of the model using alias.
82
+
83
+ This has the following differences from calling pydantic's
84
+ `self.model_dump(by_alias=True)`:
85
+
86
+ * `None` is only added to the output dict for nullable fields that
87
+ were set at model initialization. Other fields with value `None`
88
+ are ignored.
89
+ * Fields in `self.additional_properties` are added to the output dict.
90
+ """
91
+ excluded_fields: Set[str] = set([
92
+ "additional_properties",
93
+ ])
94
+
95
+ _dict = self.model_dump(
96
+ by_alias=True,
97
+ exclude=excluded_fields,
98
+ exclude_none=True,
99
+ )
100
+ # override the default output from pydantic by calling `to_dict()` of each item in lanes (list)
101
+ _items = []
102
+ if self.lanes:
103
+ for _item_lanes in self.lanes:
104
+ if _item_lanes:
105
+ _items.append(_item_lanes.to_dict())
106
+ _dict['lanes'] = _items
107
+ # puts key-value pairs in additional_properties in the top level
108
+ if self.additional_properties is not None:
109
+ for _key, _value in self.additional_properties.items():
110
+ _dict[_key] = _value
111
+
112
+ return _dict
113
+
114
+ @classmethod
115
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
116
+ """Create an instance of OsrmIntersection from a dict"""
117
+ if obj is None:
118
+ return None
119
+
120
+ if not isinstance(obj, dict):
121
+ return cls.model_validate(obj)
122
+
123
+ _obj = cls.model_validate({
124
+ "location": obj.get("location"),
125
+ "bearings": obj.get("bearings"),
126
+ "classes": obj.get("classes"),
127
+ "entry": obj.get("entry"),
128
+ "in": obj.get("in"),
129
+ "out": obj.get("out"),
130
+ "lanes": [OsrmLane.from_dict(_item) for _item in obj["lanes"]] if obj.get("lanes") is not None else None,
131
+ "admin_index": obj.get("admin_index"),
132
+ "duration": obj.get("duration"),
133
+ "turn_duration": obj.get("turn_duration"),
134
+ "turn_weight": obj.get("turn_weight"),
135
+ "geometry_index": obj.get("geometry_index"),
136
+ "weight": obj.get("weight")
137
+ })
138
+ # store additional fields in additional_properties
139
+ for _key in obj.keys():
140
+ if _key not in cls.__properties:
141
+ _obj.additional_properties[_key] = obj.get(_key)
142
+
143
+ return _obj
144
+
145
+
@@ -0,0 +1,111 @@
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, StrictBool, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OsrmLane(BaseModel):
27
+ """
28
+ OsrmLane
29
+ """ # noqa: E501
30
+ indications: List[StrictStr] = Field(description="A list of indication (e.g. marking on the road) specifying the turn lane. A road can have multiple indications (e.g. an arrow pointing straight and left).")
31
+ valid: StrictBool = Field(description="True if the lane is a valid choice for the current maneuver.")
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["indications", "valid"]
34
+
35
+ @field_validator('indications')
36
+ def indications_validate_enum(cls, value):
37
+ """Validates the enum"""
38
+ for i in value:
39
+ if i not in set(['none', 'uturn', 'sharp right', 'right', 'slight right', 'straight', 'slight left', 'left', 'sharp left']):
40
+ raise ValueError("each list item must be one of ('none', 'uturn', 'sharp right', 'right', 'slight right', 'straight', 'slight left', 'left', 'sharp left')")
41
+ return value
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
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
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of OsrmLane from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
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
+ )
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 OsrmLane 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
+ "indications": obj.get("indications"),
102
+ "valid": obj.get("valid")
103
+ })
104
+ # store additional fields in additional_properties
105
+ for _key in obj.keys():
106
+ if _key not in cls.__properties:
107
+ _obj.additional_properties[_key] = obj.get(_key)
108
+
109
+ return _obj
110
+
111
+
@@ -0,0 +1,119 @@
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, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from stadiamaps.models.osrm_route_leg import OsrmRouteLeg
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class OsrmRoute(BaseModel):
28
+ """
29
+ OsrmRoute
30
+ """ # noqa: E501
31
+ distance: Union[StrictFloat, StrictInt] = Field(description="The distance traveled by the route, in meters.")
32
+ duration: Union[StrictFloat, StrictInt] = Field(description="The estimated travel time, in number of seconds.")
33
+ geometry: StrictStr = Field(description="An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm).")
34
+ weight: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total cost of the route computed by the routing engine.")
35
+ weight_name: Optional[StrictStr] = Field(default=None, description="The costing model used for the route.")
36
+ legs: List[OsrmRouteLeg]
37
+ additional_properties: Dict[str, Any] = {}
38
+ __properties: ClassVar[List[str]] = ["distance", "duration", "geometry", "weight", "weight_name", "legs"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of OsrmRoute from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ * Fields in `self.additional_properties` are added to the output dict.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ "additional_properties",
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # override the default output from pydantic by calling `to_dict()` of each item in legs (list)
82
+ _items = []
83
+ if self.legs:
84
+ for _item_legs in self.legs:
85
+ if _item_legs:
86
+ _items.append(_item_legs.to_dict())
87
+ _dict['legs'] = _items
88
+ # puts key-value pairs in additional_properties in the top level
89
+ if self.additional_properties is not None:
90
+ for _key, _value in self.additional_properties.items():
91
+ _dict[_key] = _value
92
+
93
+ return _dict
94
+
95
+ @classmethod
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
+ """Create an instance of OsrmRoute from a dict"""
98
+ if obj is None:
99
+ return None
100
+
101
+ if not isinstance(obj, dict):
102
+ return cls.model_validate(obj)
103
+
104
+ _obj = cls.model_validate({
105
+ "distance": obj.get("distance"),
106
+ "duration": obj.get("duration"),
107
+ "geometry": obj.get("geometry"),
108
+ "weight": obj.get("weight"),
109
+ "weight_name": obj.get("weight_name"),
110
+ "legs": [OsrmRouteLeg.from_dict(_item) for _item in obj["legs"]] if obj.get("legs") is not None else None
111
+ })
112
+ # store additional fields in additional_properties
113
+ for _key in obj.keys():
114
+ if _key not in cls.__properties:
115
+ _obj.additional_properties[_key] = obj.get(_key)
116
+
117
+ return _obj
118
+
119
+
@@ -0,0 +1,148 @@
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, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional, Union
23
+ from stadiamaps.models.osrm_admin import OsrmAdmin
24
+ from stadiamaps.models.osrm_annotation import OsrmAnnotation
25
+ from stadiamaps.models.osrm_route_step import OsrmRouteStep
26
+ from stadiamaps.models.osrm_via_waypoint import OsrmViaWaypoint
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class OsrmRouteLeg(BaseModel):
31
+ """
32
+ OsrmRouteLeg
33
+ """ # noqa: E501
34
+ distance: Union[StrictFloat, StrictInt] = Field(description="The distance traveled by the route, in meters.")
35
+ duration: Union[StrictFloat, StrictInt] = Field(description="The estimated travel time, in number of seconds.")
36
+ weight: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total cost of the leg computed by the routing engine.")
37
+ summary: Optional[StrictStr] = None
38
+ steps: List[OsrmRouteStep]
39
+ annotation: Optional[OsrmAnnotation] = None
40
+ via_waypoints: Optional[List[OsrmViaWaypoint]] = Field(default=None, description="Indicates which waypoints are passed through rather than creating a new leg.")
41
+ admins: Optional[List[OsrmAdmin]] = Field(default=None, description="Administrative regions visited along the leg.")
42
+ additional_properties: Dict[str, Any] = {}
43
+ __properties: ClassVar[List[str]] = ["distance", "duration", "weight", "summary", "steps", "annotation", "via_waypoints", "admins"]
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 OsrmRouteLeg 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
+ # override the default output from pydantic by calling `to_dict()` of each item in steps (list)
87
+ _items = []
88
+ if self.steps:
89
+ for _item_steps in self.steps:
90
+ if _item_steps:
91
+ _items.append(_item_steps.to_dict())
92
+ _dict['steps'] = _items
93
+ # override the default output from pydantic by calling `to_dict()` of annotation
94
+ if self.annotation:
95
+ _dict['annotation'] = self.annotation.to_dict()
96
+ # override the default output from pydantic by calling `to_dict()` of each item in via_waypoints (list)
97
+ _items = []
98
+ if self.via_waypoints:
99
+ for _item_via_waypoints in self.via_waypoints:
100
+ if _item_via_waypoints:
101
+ _items.append(_item_via_waypoints.to_dict())
102
+ _dict['via_waypoints'] = _items
103
+ # override the default output from pydantic by calling `to_dict()` of each item in admins (list)
104
+ _items = []
105
+ if self.admins:
106
+ for _item_admins in self.admins:
107
+ if _item_admins:
108
+ _items.append(_item_admins.to_dict())
109
+ _dict['admins'] = _items
110
+ # puts key-value pairs in additional_properties in the top level
111
+ if self.additional_properties is not None:
112
+ for _key, _value in self.additional_properties.items():
113
+ _dict[_key] = _value
114
+
115
+ # set to None if via_waypoints (nullable) is None
116
+ # and model_fields_set contains the field
117
+ if self.via_waypoints is None and "via_waypoints" in self.model_fields_set:
118
+ _dict['via_waypoints'] = None
119
+
120
+ return _dict
121
+
122
+ @classmethod
123
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
124
+ """Create an instance of OsrmRouteLeg from a dict"""
125
+ if obj is None:
126
+ return None
127
+
128
+ if not isinstance(obj, dict):
129
+ return cls.model_validate(obj)
130
+
131
+ _obj = cls.model_validate({
132
+ "distance": obj.get("distance"),
133
+ "duration": obj.get("duration"),
134
+ "weight": obj.get("weight"),
135
+ "summary": obj.get("summary"),
136
+ "steps": [OsrmRouteStep.from_dict(_item) for _item in obj["steps"]] if obj.get("steps") is not None else None,
137
+ "annotation": OsrmAnnotation.from_dict(obj["annotation"]) if obj.get("annotation") is not None else None,
138
+ "via_waypoints": [OsrmViaWaypoint.from_dict(_item) for _item in obj["via_waypoints"]] if obj.get("via_waypoints") is not None else None,
139
+ "admins": [OsrmAdmin.from_dict(_item) for _item in obj["admins"]] if obj.get("admins") is not None else None
140
+ })
141
+ # store additional fields in additional_properties
142
+ for _key in obj.keys():
143
+ if _key not in cls.__properties:
144
+ _obj.additional_properties[_key] = obj.get(_key)
145
+
146
+ return _obj
147
+
148
+