stadiamaps 4.0.0__py3-none-any.whl → 6.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 (164) hide show
  1. stadiamaps/__init__.py +32 -14
  2. stadiamaps/api/geocoding_api.py +976 -153
  3. stadiamaps/api/geospatial_api.py +7 -3
  4. stadiamaps/api/routing_api.py +22 -8
  5. stadiamaps/api_client.py +15 -6
  6. stadiamaps/configuration.py +156 -40
  7. stadiamaps/exceptions.py +18 -1
  8. stadiamaps/models/__init__.py +31 -13
  9. stadiamaps/models/access.py +1 -1
  10. stadiamaps/models/addendum_v2.py +143 -0
  11. stadiamaps/models/address_components_v2.py +134 -0
  12. stadiamaps/models/admin_region.py +1 -1
  13. stadiamaps/models/administrative.py +1 -1
  14. stadiamaps/models/annotation_filters.py +1 -1
  15. stadiamaps/models/auto_costing_options.py +1 -1
  16. stadiamaps/models/base_costing_options.py +1 -1
  17. stadiamaps/models/base_trace_request.py +4 -4
  18. stadiamaps/models/bicycle_costing_options.py +1 -1
  19. stadiamaps/models/bike_network.py +1 -1
  20. stadiamaps/models/bulk_request.py +1 -1
  21. stadiamaps/models/bulk_request_query.py +1 -1
  22. stadiamaps/models/bulk_search_response.py +4 -4
  23. stadiamaps/models/context.py +119 -0
  24. stadiamaps/models/contour.py +1 -1
  25. stadiamaps/models/coordinate.py +1 -1
  26. stadiamaps/models/costing_model.py +1 -1
  27. stadiamaps/models/costing_options.py +1 -1
  28. stadiamaps/models/directions_options.py +4 -4
  29. stadiamaps/models/distance_unit.py +1 -1
  30. stadiamaps/models/edge_sign.py +1 -1
  31. stadiamaps/models/edge_use.py +1 -1
  32. stadiamaps/models/end_node.py +1 -1
  33. stadiamaps/models/extended_directions_options.py +1 -1
  34. stadiamaps/models/feature_properties_v2.py +126 -0
  35. stadiamaps/models/feature_properties_v2_properties.py +184 -0
  36. stadiamaps/models/foursquare_addendum.py +113 -0
  37. stadiamaps/models/geo_attributes.py +1 -1
  38. stadiamaps/models/geo_json_geometry.py +1 -1
  39. stadiamaps/models/geo_json_geometry_base.py +1 -1
  40. stadiamaps/models/geo_json_line_string.py +1 -1
  41. stadiamaps/models/geo_json_point.py +1 -1
  42. stadiamaps/models/geo_json_polygon.py +1 -1
  43. stadiamaps/models/{pelias_response.py → geocode_response.py} +8 -8
  44. stadiamaps/models/geocode_response_envelope_properties_v2.py +125 -0
  45. stadiamaps/models/{pelias_geo_json_feature.py → geocoding_geo_json_feature.py} +8 -8
  46. stadiamaps/models/{pelias_geo_json_properties.py → geocoding_geo_json_properties.py} +43 -15
  47. stadiamaps/models/{pelias_geo_json_properties_addendum.py → geocoding_geo_json_properties_addendum.py} +7 -7
  48. stadiamaps/models/{pelias_geo_json_properties_addendum_osm.py → geocoding_geo_json_properties_addendum_osm.py} +5 -5
  49. stadiamaps/models/{pelias_layer.py → geocoding_layer.py} +3 -3
  50. stadiamaps/models/geocoding_meta.py +108 -0
  51. stadiamaps/models/geocoding_object.py +1 -1
  52. stadiamaps/models/{pelias_source.py → geocoding_source.py} +4 -3
  53. stadiamaps/models/geonames_addendum.py +101 -0
  54. stadiamaps/models/height_request.py +1 -1
  55. stadiamaps/models/height_response.py +1 -1
  56. stadiamaps/models/highway_classification.py +1 -1
  57. stadiamaps/models/intersecting_edge.py +1 -1
  58. stadiamaps/models/isochrone_costing_model.py +1 -1
  59. stadiamaps/models/isochrone_feature.py +1 -1
  60. stadiamaps/models/isochrone_properties.py +1 -1
  61. stadiamaps/models/isochrone_request.py +1 -1
  62. stadiamaps/models/isochrone_response.py +1 -1
  63. stadiamaps/models/layer_id.py +57 -0
  64. stadiamaps/models/locate_detailed_edge.py +1 -1
  65. stadiamaps/models/locate_edge.py +1 -1
  66. stadiamaps/models/locate_edge_info.py +1 -1
  67. stadiamaps/models/locate_node.py +1 -1
  68. stadiamaps/models/locate_object.py +1 -1
  69. stadiamaps/models/low_speed_vehicle_costing_options.py +1 -1
  70. stadiamaps/models/maneuver_sign.py +1 -1
  71. stadiamaps/models/maneuver_sign_element.py +1 -1
  72. stadiamaps/models/map_match_costing_model.py +1 -1
  73. stadiamaps/models/map_match_request.py +10 -8
  74. stadiamaps/models/map_match_route_response.py +1 -1
  75. stadiamaps/models/map_match_trace_options.py +1 -1
  76. stadiamaps/models/map_match_waypoint.py +3 -3
  77. stadiamaps/models/match_type.py +39 -0
  78. stadiamaps/models/matched_point.py +1 -1
  79. stadiamaps/models/matrix_costing_model.py +1 -1
  80. stadiamaps/models/matrix_distance.py +1 -1
  81. stadiamaps/models/matrix_request.py +4 -4
  82. stadiamaps/models/matrix_response.py +4 -4
  83. stadiamaps/models/matrix_waypoint.py +1 -1
  84. stadiamaps/models/motor_scooter_costing_options.py +1 -1
  85. stadiamaps/models/motorcycle_costing_options.py +1 -1
  86. stadiamaps/models/nearest_roads_request.py +4 -4
  87. stadiamaps/models/node_id.py +1 -1
  88. stadiamaps/models/node_type.py +1 -1
  89. stadiamaps/models/open_street_map_addendum.py +162 -0
  90. stadiamaps/models/optimized_route_request.py +10 -8
  91. stadiamaps/models/osrm_admin.py +1 -1
  92. stadiamaps/models/osrm_annotation.py +1 -1
  93. stadiamaps/models/osrm_banner_component.py +1 -1
  94. stadiamaps/models/osrm_banner_content.py +1 -1
  95. stadiamaps/models/osrm_banner_instruction.py +1 -1
  96. stadiamaps/models/osrm_base_api_response.py +1 -1
  97. stadiamaps/models/osrm_guidance_modifier.py +1 -1
  98. stadiamaps/models/osrm_intersection.py +1 -1
  99. stadiamaps/models/osrm_lane.py +1 -1
  100. stadiamaps/models/osrm_route.py +1 -1
  101. stadiamaps/models/osrm_route_leg.py +1 -1
  102. stadiamaps/models/osrm_route_response.py +1 -1
  103. stadiamaps/models/osrm_route_step.py +1 -1
  104. stadiamaps/models/osrm_speed_limit.py +1 -1
  105. stadiamaps/models/osrm_step_maneuver.py +1 -1
  106. stadiamaps/models/osrm_via_waypoint.py +1 -1
  107. stadiamaps/models/osrm_voice_instruction.py +1 -1
  108. stadiamaps/models/osrm_waypoint.py +1 -1
  109. stadiamaps/models/pedestrian_costing_options.py +8 -5
  110. stadiamaps/models/pedestrian_type.py +39 -0
  111. stadiamaps/models/point.py +104 -0
  112. stadiamaps/models/precision.py +38 -0
  113. stadiamaps/models/properties_v2.py +184 -0
  114. stadiamaps/models/restrictions.py +11 -11
  115. stadiamaps/models/road_class.py +1 -1
  116. stadiamaps/models/route200_response.py +1 -1
  117. stadiamaps/models/route_leg.py +1 -1
  118. stadiamaps/models/route_maneuver.py +1 -1
  119. stadiamaps/models/route_request.py +5 -5
  120. stadiamaps/models/route_response.py +1 -1
  121. stadiamaps/models/route_response_alternates_inner.py +1 -1
  122. stadiamaps/models/route_summary.py +1 -1
  123. stadiamaps/models/route_trip.py +7 -7
  124. stadiamaps/models/{valhalla_languages.py → routing_languages.py} +4 -4
  125. stadiamaps/models/{valhalla_long_units.py → routing_long_units.py} +4 -4
  126. stadiamaps/models/routing_response_waypoint.py +3 -3
  127. stadiamaps/models/routing_waypoint.py +3 -3
  128. stadiamaps/models/routing_waypoint_all_of_search_filter.py +1 -1
  129. stadiamaps/models/search_query.py +7 -7
  130. stadiamaps/models/search_structured_query.py +8 -8
  131. stadiamaps/models/simple_routing_waypoint.py +3 -3
  132. stadiamaps/models/source_attribution.py +110 -0
  133. stadiamaps/models/source_id.py +41 -0
  134. stadiamaps/models/speeds.py +1 -1
  135. stadiamaps/models/trace_attribute_filter_options.py +1 -1
  136. stadiamaps/models/trace_attribute_key.py +1 -1
  137. stadiamaps/models/trace_attributes_base_response.py +1 -1
  138. stadiamaps/models/trace_attributes_request.py +10 -8
  139. stadiamaps/models/trace_attributes_response.py +4 -9
  140. stadiamaps/models/trace_edge.py +2 -7
  141. stadiamaps/models/travel_mode.py +1 -1
  142. stadiamaps/models/traversability.py +1 -1
  143. stadiamaps/models/truck_costing_options.py +1 -1
  144. stadiamaps/models/tz_response.py +1 -1
  145. stadiamaps/models/warning.py +1 -1
  146. stadiamaps/models/whos_on_first_concordances.py +246 -0
  147. stadiamaps/models/wof_context.py +210 -0
  148. stadiamaps/models/wof_context_component.py +110 -0
  149. stadiamaps/rest.py +2 -2
  150. stadiamaps-6.0.0.dist-info/METADATA +117 -0
  151. stadiamaps-6.0.0.dist-info/RECORD +183 -0
  152. {stadiamaps-4.0.0.dist-info → stadiamaps-6.0.0.dist-info}/WHEEL +1 -1
  153. {stadiamaps-4.0.0.dist-info → stadiamaps-6.0.0.dist-info}/top_level.txt +1 -0
  154. test/integration/__init__.py +0 -0
  155. test/integration/test_eu_endpoint.py +21 -0
  156. test/integration/test_gecoding.py +112 -0
  157. test/integration/test_geospatial.py +43 -0
  158. test/integration/test_routing.py +282 -0
  159. stadiamaps/models/pelias_response_geocoding.py +0 -89
  160. stadiamaps/models/route_response_trip.py +0 -117
  161. stadiamaps/models/trace_attributes_response_all_of.py +0 -96
  162. stadiamaps-4.0.0.dist-info/METADATA +0 -79
  163. stadiamaps-4.0.0.dist-info/RECORD +0 -160
  164. {stadiamaps-4.0.0.dist-info → stadiamaps-6.0.0.dist-info/licenses}/LICENSE.txt +0 -0
@@ -0,0 +1,246 @@
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: 9.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, StrictInt, 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 WhosOnFirstConcordances(BaseModel):
27
+ """
28
+ WhosOnFirstConcordances
29
+ """ # noqa: E501
30
+ eurographics_gisco_id: Optional[StrictStr] = None
31
+ faa_code: Optional[StrictStr] = None
32
+ factual_id: Optional[StrictStr] = None
33
+ fifa_id: Optional[StrictStr] = None
34
+ fips_code: Optional[StrictStr] = None
35
+ fr_gov_epci_code: Optional[StrictInt] = Field(default=None, description="An Open Data France EPCI code.")
36
+ fra_insee_code: Optional[StrictInt] = Field(default=None, description="Institut national de la statistique et des études économiques (Insee) code")
37
+ geonames_id: Optional[StrictInt] = None
38
+ geoplanet_id: Optional[StrictInt] = None
39
+ hasc_id: Optional[StrictStr] = Field(default=None, description="A Statoids HASC ID.")
40
+ iata_code: Optional[StrictStr] = None
41
+ icao_code: Optional[StrictStr] = None
42
+ itu_id: Optional[StrictStr] = None
43
+ karmashapes_id: Optional[StrictInt] = None
44
+ natural_earth_id: Optional[StrictStr] = None
45
+ nuts_2021_id: Optional[StrictStr] = Field(default=None, description="A Eurostat NUTS 2021 ID")
46
+ quattroshapes_id: Optional[StrictInt] = None
47
+ quattroshapes_pg_id: Optional[StrictInt] = Field(default=None, description="A Quattroshapes Point Gazetteer ID.")
48
+ us_census_geo_id: Optional[StrictInt] = None
49
+ wikidata_id: Optional[StrictStr] = None
50
+ wikipedia_page: Optional[StrictStr] = None
51
+ additional_properties: Dict[str, Any] = {}
52
+ __properties: ClassVar[List[str]] = ["eurographics_gisco_id", "faa_code", "factual_id", "fifa_id", "fips_code", "fr_gov_epci_code", "fra_insee_code", "geonames_id", "geoplanet_id", "hasc_id", "iata_code", "icao_code", "itu_id", "karmashapes_id", "natural_earth_id", "nuts_2021_id", "quattroshapes_id", "quattroshapes_pg_id", "us_census_geo_id", "wikidata_id", "wikipedia_page"]
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """Returns the JSON representation of the model using alias"""
67
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
68
+ return json.dumps(self.to_dict())
69
+
70
+ @classmethod
71
+ def from_json(cls, json_str: str) -> Optional[Self]:
72
+ """Create an instance of WhosOnFirstConcordances from a JSON string"""
73
+ return cls.from_dict(json.loads(json_str))
74
+
75
+ def to_dict(self) -> Dict[str, Any]:
76
+ """Return the dictionary representation of the model using alias.
77
+
78
+ This has the following differences from calling pydantic's
79
+ `self.model_dump(by_alias=True)`:
80
+
81
+ * `None` is only added to the output dict for nullable fields that
82
+ were set at model initialization. Other fields with value `None`
83
+ are ignored.
84
+ * Fields in `self.additional_properties` are added to the output dict.
85
+ """
86
+ excluded_fields: Set[str] = set([
87
+ "additional_properties",
88
+ ])
89
+
90
+ _dict = self.model_dump(
91
+ by_alias=True,
92
+ exclude=excluded_fields,
93
+ exclude_none=True,
94
+ )
95
+ # puts key-value pairs in additional_properties in the top level
96
+ if self.additional_properties is not None:
97
+ for _key, _value in self.additional_properties.items():
98
+ _dict[_key] = _value
99
+
100
+ # set to None if eurographics_gisco_id (nullable) is None
101
+ # and model_fields_set contains the field
102
+ if self.eurographics_gisco_id is None and "eurographics_gisco_id" in self.model_fields_set:
103
+ _dict['eurographics_gisco_id'] = None
104
+
105
+ # set to None if faa_code (nullable) is None
106
+ # and model_fields_set contains the field
107
+ if self.faa_code is None and "faa_code" in self.model_fields_set:
108
+ _dict['faa_code'] = None
109
+
110
+ # set to None if factual_id (nullable) is None
111
+ # and model_fields_set contains the field
112
+ if self.factual_id is None and "factual_id" in self.model_fields_set:
113
+ _dict['factual_id'] = None
114
+
115
+ # set to None if fifa_id (nullable) is None
116
+ # and model_fields_set contains the field
117
+ if self.fifa_id is None and "fifa_id" in self.model_fields_set:
118
+ _dict['fifa_id'] = None
119
+
120
+ # set to None if fips_code (nullable) is None
121
+ # and model_fields_set contains the field
122
+ if self.fips_code is None and "fips_code" in self.model_fields_set:
123
+ _dict['fips_code'] = None
124
+
125
+ # set to None if fr_gov_epci_code (nullable) is None
126
+ # and model_fields_set contains the field
127
+ if self.fr_gov_epci_code is None and "fr_gov_epci_code" in self.model_fields_set:
128
+ _dict['fr_gov_epci_code'] = None
129
+
130
+ # set to None if fra_insee_code (nullable) is None
131
+ # and model_fields_set contains the field
132
+ if self.fra_insee_code is None and "fra_insee_code" in self.model_fields_set:
133
+ _dict['fra_insee_code'] = None
134
+
135
+ # set to None if geonames_id (nullable) is None
136
+ # and model_fields_set contains the field
137
+ if self.geonames_id is None and "geonames_id" in self.model_fields_set:
138
+ _dict['geonames_id'] = None
139
+
140
+ # set to None if geoplanet_id (nullable) is None
141
+ # and model_fields_set contains the field
142
+ if self.geoplanet_id is None and "geoplanet_id" in self.model_fields_set:
143
+ _dict['geoplanet_id'] = None
144
+
145
+ # set to None if hasc_id (nullable) is None
146
+ # and model_fields_set contains the field
147
+ if self.hasc_id is None and "hasc_id" in self.model_fields_set:
148
+ _dict['hasc_id'] = None
149
+
150
+ # set to None if iata_code (nullable) is None
151
+ # and model_fields_set contains the field
152
+ if self.iata_code is None and "iata_code" in self.model_fields_set:
153
+ _dict['iata_code'] = None
154
+
155
+ # set to None if icao_code (nullable) is None
156
+ # and model_fields_set contains the field
157
+ if self.icao_code is None and "icao_code" in self.model_fields_set:
158
+ _dict['icao_code'] = None
159
+
160
+ # set to None if itu_id (nullable) is None
161
+ # and model_fields_set contains the field
162
+ if self.itu_id is None and "itu_id" in self.model_fields_set:
163
+ _dict['itu_id'] = None
164
+
165
+ # set to None if karmashapes_id (nullable) is None
166
+ # and model_fields_set contains the field
167
+ if self.karmashapes_id is None and "karmashapes_id" in self.model_fields_set:
168
+ _dict['karmashapes_id'] = None
169
+
170
+ # set to None if natural_earth_id (nullable) is None
171
+ # and model_fields_set contains the field
172
+ if self.natural_earth_id is None and "natural_earth_id" in self.model_fields_set:
173
+ _dict['natural_earth_id'] = None
174
+
175
+ # set to None if nuts_2021_id (nullable) is None
176
+ # and model_fields_set contains the field
177
+ if self.nuts_2021_id is None and "nuts_2021_id" in self.model_fields_set:
178
+ _dict['nuts_2021_id'] = None
179
+
180
+ # set to None if quattroshapes_id (nullable) is None
181
+ # and model_fields_set contains the field
182
+ if self.quattroshapes_id is None and "quattroshapes_id" in self.model_fields_set:
183
+ _dict['quattroshapes_id'] = None
184
+
185
+ # set to None if quattroshapes_pg_id (nullable) is None
186
+ # and model_fields_set contains the field
187
+ if self.quattroshapes_pg_id is None and "quattroshapes_pg_id" in self.model_fields_set:
188
+ _dict['quattroshapes_pg_id'] = None
189
+
190
+ # set to None if us_census_geo_id (nullable) is None
191
+ # and model_fields_set contains the field
192
+ if self.us_census_geo_id is None and "us_census_geo_id" in self.model_fields_set:
193
+ _dict['us_census_geo_id'] = None
194
+
195
+ # set to None if wikidata_id (nullable) is None
196
+ # and model_fields_set contains the field
197
+ if self.wikidata_id is None and "wikidata_id" in self.model_fields_set:
198
+ _dict['wikidata_id'] = None
199
+
200
+ # set to None if wikipedia_page (nullable) is None
201
+ # and model_fields_set contains the field
202
+ if self.wikipedia_page is None and "wikipedia_page" in self.model_fields_set:
203
+ _dict['wikipedia_page'] = None
204
+
205
+ return _dict
206
+
207
+ @classmethod
208
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
209
+ """Create an instance of WhosOnFirstConcordances from a dict"""
210
+ if obj is None:
211
+ return None
212
+
213
+ if not isinstance(obj, dict):
214
+ return cls.model_validate(obj)
215
+
216
+ _obj = cls.model_validate({
217
+ "eurographics_gisco_id": obj.get("eurographics_gisco_id"),
218
+ "faa_code": obj.get("faa_code"),
219
+ "factual_id": obj.get("factual_id"),
220
+ "fifa_id": obj.get("fifa_id"),
221
+ "fips_code": obj.get("fips_code"),
222
+ "fr_gov_epci_code": obj.get("fr_gov_epci_code"),
223
+ "fra_insee_code": obj.get("fra_insee_code"),
224
+ "geonames_id": obj.get("geonames_id"),
225
+ "geoplanet_id": obj.get("geoplanet_id"),
226
+ "hasc_id": obj.get("hasc_id"),
227
+ "iata_code": obj.get("iata_code"),
228
+ "icao_code": obj.get("icao_code"),
229
+ "itu_id": obj.get("itu_id"),
230
+ "karmashapes_id": obj.get("karmashapes_id"),
231
+ "natural_earth_id": obj.get("natural_earth_id"),
232
+ "nuts_2021_id": obj.get("nuts_2021_id"),
233
+ "quattroshapes_id": obj.get("quattroshapes_id"),
234
+ "quattroshapes_pg_id": obj.get("quattroshapes_pg_id"),
235
+ "us_census_geo_id": obj.get("us_census_geo_id"),
236
+ "wikidata_id": obj.get("wikidata_id"),
237
+ "wikipedia_page": obj.get("wikipedia_page")
238
+ })
239
+ # store additional fields in additional_properties
240
+ for _key in obj.keys():
241
+ if _key not in cls.__properties:
242
+ _obj.additional_properties[_key] = obj.get(_key)
243
+
244
+ return _obj
245
+
246
+
@@ -0,0 +1,210 @@
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: 9.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
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from stadiamaps.models.wof_context_component import WofContextComponent
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class WofContext(BaseModel):
28
+ """
29
+ WofContext
30
+ """ # noqa: E501
31
+ borough: Optional[WofContextComponent] = None
32
+ continent: Optional[WofContextComponent] = None
33
+ country: Optional[WofContextComponent] = None
34
+ county: Optional[WofContextComponent] = None
35
+ dependency: Optional[WofContextComponent] = None
36
+ localadmin: Optional[WofContextComponent] = None
37
+ locality: Optional[WofContextComponent] = None
38
+ macrocounty: Optional[WofContextComponent] = None
39
+ macroregion: Optional[WofContextComponent] = None
40
+ neighbourhood: Optional[WofContextComponent] = None
41
+ region: Optional[WofContextComponent] = None
42
+ additional_properties: Dict[str, Any] = {}
43
+ __properties: ClassVar[List[str]] = ["borough", "continent", "country", "county", "dependency", "localadmin", "locality", "macrocounty", "macroregion", "neighbourhood", "region"]
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 WofContext 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 borough
87
+ if self.borough:
88
+ _dict['borough'] = self.borough.to_dict()
89
+ # override the default output from pydantic by calling `to_dict()` of continent
90
+ if self.continent:
91
+ _dict['continent'] = self.continent.to_dict()
92
+ # override the default output from pydantic by calling `to_dict()` of country
93
+ if self.country:
94
+ _dict['country'] = self.country.to_dict()
95
+ # override the default output from pydantic by calling `to_dict()` of county
96
+ if self.county:
97
+ _dict['county'] = self.county.to_dict()
98
+ # override the default output from pydantic by calling `to_dict()` of dependency
99
+ if self.dependency:
100
+ _dict['dependency'] = self.dependency.to_dict()
101
+ # override the default output from pydantic by calling `to_dict()` of localadmin
102
+ if self.localadmin:
103
+ _dict['localadmin'] = self.localadmin.to_dict()
104
+ # override the default output from pydantic by calling `to_dict()` of locality
105
+ if self.locality:
106
+ _dict['locality'] = self.locality.to_dict()
107
+ # override the default output from pydantic by calling `to_dict()` of macrocounty
108
+ if self.macrocounty:
109
+ _dict['macrocounty'] = self.macrocounty.to_dict()
110
+ # override the default output from pydantic by calling `to_dict()` of macroregion
111
+ if self.macroregion:
112
+ _dict['macroregion'] = self.macroregion.to_dict()
113
+ # override the default output from pydantic by calling `to_dict()` of neighbourhood
114
+ if self.neighbourhood:
115
+ _dict['neighbourhood'] = self.neighbourhood.to_dict()
116
+ # override the default output from pydantic by calling `to_dict()` of region
117
+ if self.region:
118
+ _dict['region'] = self.region.to_dict()
119
+ # puts key-value pairs in additional_properties in the top level
120
+ if self.additional_properties is not None:
121
+ for _key, _value in self.additional_properties.items():
122
+ _dict[_key] = _value
123
+
124
+ # set to None if borough (nullable) is None
125
+ # and model_fields_set contains the field
126
+ if self.borough is None and "borough" in self.model_fields_set:
127
+ _dict['borough'] = None
128
+
129
+ # set to None if continent (nullable) is None
130
+ # and model_fields_set contains the field
131
+ if self.continent is None and "continent" in self.model_fields_set:
132
+ _dict['continent'] = None
133
+
134
+ # set to None if country (nullable) is None
135
+ # and model_fields_set contains the field
136
+ if self.country is None and "country" in self.model_fields_set:
137
+ _dict['country'] = None
138
+
139
+ # set to None if county (nullable) is None
140
+ # and model_fields_set contains the field
141
+ if self.county is None and "county" in self.model_fields_set:
142
+ _dict['county'] = None
143
+
144
+ # set to None if dependency (nullable) is None
145
+ # and model_fields_set contains the field
146
+ if self.dependency is None and "dependency" in self.model_fields_set:
147
+ _dict['dependency'] = None
148
+
149
+ # set to None if localadmin (nullable) is None
150
+ # and model_fields_set contains the field
151
+ if self.localadmin is None and "localadmin" in self.model_fields_set:
152
+ _dict['localadmin'] = None
153
+
154
+ # set to None if locality (nullable) is None
155
+ # and model_fields_set contains the field
156
+ if self.locality is None and "locality" in self.model_fields_set:
157
+ _dict['locality'] = None
158
+
159
+ # set to None if macrocounty (nullable) is None
160
+ # and model_fields_set contains the field
161
+ if self.macrocounty is None and "macrocounty" in self.model_fields_set:
162
+ _dict['macrocounty'] = None
163
+
164
+ # set to None if macroregion (nullable) is None
165
+ # and model_fields_set contains the field
166
+ if self.macroregion is None and "macroregion" in self.model_fields_set:
167
+ _dict['macroregion'] = None
168
+
169
+ # set to None if neighbourhood (nullable) is None
170
+ # and model_fields_set contains the field
171
+ if self.neighbourhood is None and "neighbourhood" in self.model_fields_set:
172
+ _dict['neighbourhood'] = None
173
+
174
+ # set to None if region (nullable) is None
175
+ # and model_fields_set contains the field
176
+ if self.region is None and "region" in self.model_fields_set:
177
+ _dict['region'] = None
178
+
179
+ return _dict
180
+
181
+ @classmethod
182
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
183
+ """Create an instance of WofContext from a dict"""
184
+ if obj is None:
185
+ return None
186
+
187
+ if not isinstance(obj, dict):
188
+ return cls.model_validate(obj)
189
+
190
+ _obj = cls.model_validate({
191
+ "borough": WofContextComponent.from_dict(obj["borough"]) if obj.get("borough") is not None else None,
192
+ "continent": WofContextComponent.from_dict(obj["continent"]) if obj.get("continent") is not None else None,
193
+ "country": WofContextComponent.from_dict(obj["country"]) if obj.get("country") is not None else None,
194
+ "county": WofContextComponent.from_dict(obj["county"]) if obj.get("county") is not None else None,
195
+ "dependency": WofContextComponent.from_dict(obj["dependency"]) if obj.get("dependency") is not None else None,
196
+ "localadmin": WofContextComponent.from_dict(obj["localadmin"]) if obj.get("localadmin") is not None else None,
197
+ "locality": WofContextComponent.from_dict(obj["locality"]) if obj.get("locality") is not None else None,
198
+ "macrocounty": WofContextComponent.from_dict(obj["macrocounty"]) if obj.get("macrocounty") is not None else None,
199
+ "macroregion": WofContextComponent.from_dict(obj["macroregion"]) if obj.get("macroregion") is not None else None,
200
+ "neighbourhood": WofContextComponent.from_dict(obj["neighbourhood"]) if obj.get("neighbourhood") is not None else None,
201
+ "region": WofContextComponent.from_dict(obj["region"]) if obj.get("region") is not None else None
202
+ })
203
+ # store additional fields in additional_properties
204
+ for _key in obj.keys():
205
+ if _key not in cls.__properties:
206
+ _obj.additional_properties[_key] = obj.get(_key)
207
+
208
+ return _obj
209
+
210
+
@@ -0,0 +1,110 @@
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: 9.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 WofContextComponent(BaseModel):
27
+ """
28
+ WofContextComponent
29
+ """ # noqa: E501
30
+ abbreviation: Optional[StrictStr] = None
31
+ gid: StrictStr = Field(description="A globally unique identifier for a feature. Note: these are not stable for all datasets! For example, OSM features may be deleted and re-added with a new ID. Others like Who's on First guarantee stability long term.")
32
+ name: StrictStr
33
+ additional_properties: Dict[str, Any] = {}
34
+ __properties: ClassVar[List[str]] = ["abbreviation", "gid", "name"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of WofContextComponent from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ * Fields in `self.additional_properties` are added to the output dict.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ "additional_properties",
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # puts key-value pairs in additional_properties in the top level
78
+ if self.additional_properties is not None:
79
+ for _key, _value in self.additional_properties.items():
80
+ _dict[_key] = _value
81
+
82
+ # set to None if abbreviation (nullable) is None
83
+ # and model_fields_set contains the field
84
+ if self.abbreviation is None and "abbreviation" in self.model_fields_set:
85
+ _dict['abbreviation'] = None
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of WofContextComponent from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "abbreviation": obj.get("abbreviation"),
100
+ "gid": obj.get("gid"),
101
+ "name": obj.get("name")
102
+ })
103
+ # store additional fields in additional_properties
104
+ for _key in obj.keys():
105
+ if _key not in cls.__properties:
106
+ _obj.additional_properties[_key] = obj.get(_key)
107
+
108
+ return _obj
109
+
110
+
stadiamaps/rest.py CHANGED
@@ -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: 7.0.0
8
+ The version of the OpenAPI document: 9.0.0
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
@@ -226,7 +226,7 @@ class RESTClientObject:
226
226
  headers=headers,
227
227
  preload_content=False
228
228
  )
229
- elif headers['Content-Type'] == 'text/plain' and isinstance(body, bool):
229
+ elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
230
230
  request_body = "true" if body else "false"
231
231
  r = self.pool_manager.request(
232
232
  method,