stadiamaps 3.1.0__py3-none-any.whl → 3.2.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 (116) hide show
  1. stadiamaps/__init__.py +8 -2
  2. stadiamaps/api/geocoding_api.py +384 -101
  3. stadiamaps/api/geospatial_api.py +13 -11
  4. stadiamaps/api/routing_api.py +46 -39
  5. stadiamaps/api_client.py +22 -11
  6. stadiamaps/configuration.py +19 -5
  7. stadiamaps/exceptions.py +1 -1
  8. stadiamaps/models/__init__.py +7 -1
  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/auto_costing_options.py +1 -1
  13. stadiamaps/models/base_costing_options.py +1 -1
  14. stadiamaps/models/base_trace_request.py +5 -5
  15. stadiamaps/models/bicycle_costing_options.py +1 -1
  16. stadiamaps/models/bike_network.py +1 -1
  17. stadiamaps/models/bulk_request.py +141 -0
  18. stadiamaps/models/bulk_search_request_inner.py +141 -0
  19. stadiamaps/models/bulk_search_response.py +109 -0
  20. stadiamaps/models/contour.py +1 -1
  21. stadiamaps/models/coordinate.py +1 -1
  22. stadiamaps/models/costing_model.py +1 -1
  23. stadiamaps/models/costing_options.py +1 -1
  24. stadiamaps/models/directions_options.py +5 -5
  25. stadiamaps/models/distance_unit.py +1 -1
  26. stadiamaps/models/edge_sign.py +1 -1
  27. stadiamaps/models/edge_use.py +1 -1
  28. stadiamaps/models/end_node.py +1 -1
  29. stadiamaps/models/geo_attributes.py +1 -1
  30. stadiamaps/models/geo_json_geometry.py +1 -1
  31. stadiamaps/models/geo_json_geometry_base.py +1 -1
  32. stadiamaps/models/geo_json_line_string.py +1 -1
  33. stadiamaps/models/geo_json_point.py +1 -1
  34. stadiamaps/models/geo_json_polygon.py +1 -1
  35. stadiamaps/models/geocoding_object.py +1 -1
  36. stadiamaps/models/height_request.py +1 -1
  37. stadiamaps/models/height_response.py +1 -1
  38. stadiamaps/models/highway_classification.py +1 -1
  39. stadiamaps/models/intersecting_edge.py +1 -1
  40. stadiamaps/models/isochrone_costing_model.py +8 -1
  41. stadiamaps/models/isochrone_feature.py +1 -1
  42. stadiamaps/models/isochrone_properties.py +1 -1
  43. stadiamaps/models/isochrone_request.py +1 -1
  44. stadiamaps/models/isochrone_response.py +1 -1
  45. stadiamaps/models/locate_detailed_edge.py +1 -1
  46. stadiamaps/models/locate_edge.py +1 -1
  47. stadiamaps/models/locate_edge_info.py +1 -1
  48. stadiamaps/models/locate_node.py +1 -1
  49. stadiamaps/models/locate_object.py +1 -1
  50. stadiamaps/models/low_speed_vehicle_costing_options.py +1 -1
  51. stadiamaps/models/maneuver_sign.py +1 -1
  52. stadiamaps/models/maneuver_sign_element.py +1 -1
  53. stadiamaps/models/map_match_costing_model.py +8 -2
  54. stadiamaps/models/map_match_request.py +5 -5
  55. stadiamaps/models/map_match_route_response.py +1 -1
  56. stadiamaps/models/map_match_trace_options.py +1 -1
  57. stadiamaps/models/map_match_waypoint.py +1 -1
  58. stadiamaps/models/matched_point.py +1 -1
  59. stadiamaps/models/matrix_costing_model.py +1 -1
  60. stadiamaps/models/matrix_distance.py +1 -1
  61. stadiamaps/models/matrix_request.py +5 -5
  62. stadiamaps/models/matrix_response.py +2 -2
  63. stadiamaps/models/matrix_waypoint.py +1 -1
  64. stadiamaps/models/motor_scooter_costing_options.py +1 -1
  65. stadiamaps/models/motorcycle_costing_options.py +1 -1
  66. stadiamaps/models/nearest_roads_request.py +5 -5
  67. stadiamaps/models/node_id.py +1 -1
  68. stadiamaps/models/node_type.py +1 -1
  69. stadiamaps/models/optimized_route_request.py +5 -5
  70. stadiamaps/models/pedestrian_costing_options.py +1 -1
  71. stadiamaps/models/pelias_geo_json_feature.py +3 -5
  72. stadiamaps/models/pelias_geo_json_properties.py +2 -2
  73. stadiamaps/models/pelias_geo_json_properties_addendum.py +1 -1
  74. stadiamaps/models/pelias_geo_json_properties_addendum_osm.py +1 -1
  75. stadiamaps/models/pelias_layer.py +1 -1
  76. stadiamaps/models/pelias_response.py +1 -1
  77. stadiamaps/models/pelias_source.py +1 -1
  78. stadiamaps/models/restrictions.py +1 -1
  79. stadiamaps/models/road_class.py +1 -1
  80. stadiamaps/models/route_leg.py +2 -2
  81. stadiamaps/models/route_maneuver.py +1 -1
  82. stadiamaps/models/route_request.py +5 -5
  83. stadiamaps/models/route_response.py +1 -1
  84. stadiamaps/models/route_response_alternates_inner.py +1 -1
  85. stadiamaps/models/route_summary.py +1 -1
  86. stadiamaps/models/route_trip.py +3 -3
  87. stadiamaps/models/routing_response_waypoint.py +1 -1
  88. stadiamaps/models/routing_waypoint.py +1 -1
  89. stadiamaps/models/routing_waypoint_all_of_search_filter.py +1 -1
  90. stadiamaps/models/search_bulk_query.py +117 -0
  91. stadiamaps/models/search_bulk_request.py +141 -0
  92. stadiamaps/models/search_query.py +134 -0
  93. stadiamaps/models/search_structured_bulk_query.py +117 -0
  94. stadiamaps/models/search_structured_query.py +148 -0
  95. stadiamaps/models/simple_routing_waypoint.py +1 -1
  96. stadiamaps/models/speeds.py +1 -1
  97. stadiamaps/models/trace_attribute_filter_options.py +1 -1
  98. stadiamaps/models/trace_attribute_key.py +1 -1
  99. stadiamaps/models/trace_attributes_base_response.py +1 -1
  100. stadiamaps/models/trace_attributes_request.py +5 -5
  101. stadiamaps/models/trace_attributes_response.py +3 -3
  102. stadiamaps/models/trace_edge.py +1 -1
  103. stadiamaps/models/travel_mode.py +1 -1
  104. stadiamaps/models/traversability.py +1 -1
  105. stadiamaps/models/truck_costing_options.py +1 -1
  106. stadiamaps/models/tz_response.py +1 -1
  107. stadiamaps/models/valhalla_languages.py +1 -1
  108. stadiamaps/models/valhalla_long_units.py +1 -1
  109. stadiamaps/models/warning.py +1 -1
  110. stadiamaps/rest.py +1 -1
  111. {stadiamaps-3.1.0.dist-info → stadiamaps-3.2.0.dist-info}/METADATA +1 -1
  112. stadiamaps-3.2.0.dist-info/RECORD +138 -0
  113. {stadiamaps-3.1.0.dist-info → stadiamaps-3.2.0.dist-info}/WHEEL +1 -1
  114. stadiamaps-3.1.0.dist-info/RECORD +0 -130
  115. {stadiamaps-3.1.0.dist-info → stadiamaps-3.2.0.dist-info}/LICENSE.txt +0 -0
  116. {stadiamaps-3.1.0.dist-info → stadiamaps-3.2.0.dist-info}/top_level.txt +0 -0
@@ -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: 6.6.2
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 stadiamaps.models.search_query import SearchQuery
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class SearchBulkQuery(BaseModel):
28
+ """
29
+ SearchBulkQuery
30
+ """ # noqa: E501
31
+ endpoint: Optional[StrictStr] = None
32
+ query: Optional[SearchQuery] = None
33
+ additional_properties: Dict[str, Any] = {}
34
+ __properties: ClassVar[List[str]] = ["endpoint", "query"]
35
+
36
+ @field_validator('endpoint')
37
+ def endpoint_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value is None:
40
+ return value
41
+
42
+ if value not in set(['/v1/search']):
43
+ raise ValueError("must be one of enum values ('/v1/search')")
44
+ return value
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+
53
+ def to_str(self) -> str:
54
+ """Returns the string representation of the model using alias"""
55
+ return pprint.pformat(self.model_dump(by_alias=True))
56
+
57
+ def to_json(self) -> str:
58
+ """Returns the JSON representation of the model using alias"""
59
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60
+ return json.dumps(self.to_dict())
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
+ """Create an instance of SearchBulkQuery from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ * Fields in `self.additional_properties` are added to the output dict.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ "additional_properties",
80
+ ])
81
+
82
+ _dict = self.model_dump(
83
+ by_alias=True,
84
+ exclude=excluded_fields,
85
+ exclude_none=True,
86
+ )
87
+ # override the default output from pydantic by calling `to_dict()` of query
88
+ if self.query:
89
+ _dict['query'] = self.query.to_dict()
90
+ # puts key-value pairs in additional_properties in the top level
91
+ if self.additional_properties is not None:
92
+ for _key, _value in self.additional_properties.items():
93
+ _dict[_key] = _value
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of SearchBulkQuery from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate({
107
+ "endpoint": obj.get("endpoint"),
108
+ "query": SearchQuery.from_dict(obj["query"]) if obj.get("query") 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,141 @@
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: 6.6.2
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
+ import pprint
19
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
20
+ from typing import Any, List, Optional
21
+ from stadiamaps.models.search_bulk_query import SearchBulkQuery
22
+ from stadiamaps.models.search_structured_bulk_query import SearchStructuredBulkQuery
23
+ from pydantic import StrictStr, Field
24
+ from typing import Union, List, Set, Optional, Dict
25
+ from typing_extensions import Literal, Self
26
+
27
+ SEARCHBULKREQUEST_ONE_OF_SCHEMAS = ["SearchBulkQuery", "SearchStructuredBulkQuery"]
28
+
29
+ class SearchBulkRequest(BaseModel):
30
+ """
31
+ SearchBulkRequest
32
+ """
33
+ # data type: SearchBulkQuery
34
+ oneof_schema_1_validator: Optional[SearchBulkQuery] = None
35
+ # data type: SearchStructuredBulkQuery
36
+ oneof_schema_2_validator: Optional[SearchStructuredBulkQuery] = None
37
+ actual_instance: Optional[Union[SearchBulkQuery, SearchStructuredBulkQuery]] = None
38
+ one_of_schemas: Set[str] = { "SearchBulkQuery", "SearchStructuredBulkQuery" }
39
+
40
+ model_config = ConfigDict(
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ discriminator_value_class_map: Dict[str, str] = {
47
+ }
48
+
49
+ def __init__(self, *args, **kwargs) -> None:
50
+ if args:
51
+ if len(args) > 1:
52
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
53
+ if kwargs:
54
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
55
+ super().__init__(actual_instance=args[0])
56
+ else:
57
+ super().__init__(**kwargs)
58
+
59
+ @field_validator('actual_instance')
60
+ def actual_instance_must_validate_oneof(cls, v):
61
+ instance = SearchBulkRequest.model_construct()
62
+ error_messages = []
63
+ match = 0
64
+ # validate data type: SearchBulkQuery
65
+ if not isinstance(v, SearchBulkQuery):
66
+ error_messages.append(f"Error! Input type `{type(v)}` is not `SearchBulkQuery`")
67
+ else:
68
+ match += 1
69
+ # validate data type: SearchStructuredBulkQuery
70
+ if not isinstance(v, SearchStructuredBulkQuery):
71
+ error_messages.append(f"Error! Input type `{type(v)}` is not `SearchStructuredBulkQuery`")
72
+ else:
73
+ match += 1
74
+ if match > 1:
75
+ # more than 1 match
76
+ raise ValueError("Multiple matches found when setting `actual_instance` in SearchBulkRequest with oneOf schemas: SearchBulkQuery, SearchStructuredBulkQuery. Details: " + ", ".join(error_messages))
77
+ elif match == 0:
78
+ # no match
79
+ raise ValueError("No match found when setting `actual_instance` in SearchBulkRequest with oneOf schemas: SearchBulkQuery, SearchStructuredBulkQuery. Details: " + ", ".join(error_messages))
80
+ else:
81
+ return v
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
85
+ return cls.from_json(json.dumps(obj))
86
+
87
+ @classmethod
88
+ def from_json(cls, json_str: str) -> Self:
89
+ """Returns the object represented by the json string"""
90
+ instance = cls.model_construct()
91
+ error_messages = []
92
+ match = 0
93
+
94
+ # deserialize data into SearchBulkQuery
95
+ try:
96
+ instance.actual_instance = SearchBulkQuery.from_json(json_str)
97
+ match += 1
98
+ except (ValidationError, ValueError) as e:
99
+ error_messages.append(str(e))
100
+ # deserialize data into SearchStructuredBulkQuery
101
+ try:
102
+ instance.actual_instance = SearchStructuredBulkQuery.from_json(json_str)
103
+ match += 1
104
+ except (ValidationError, ValueError) as e:
105
+ error_messages.append(str(e))
106
+
107
+ if match > 1:
108
+ # more than 1 match
109
+ raise ValueError("Multiple matches found when deserializing the JSON string into SearchBulkRequest with oneOf schemas: SearchBulkQuery, SearchStructuredBulkQuery. Details: " + ", ".join(error_messages))
110
+ elif match == 0:
111
+ # no match
112
+ raise ValueError("No match found when deserializing the JSON string into SearchBulkRequest with oneOf schemas: SearchBulkQuery, SearchStructuredBulkQuery. Details: " + ", ".join(error_messages))
113
+ else:
114
+ return instance
115
+
116
+ def to_json(self) -> str:
117
+ """Returns the JSON representation of the actual instance"""
118
+ if self.actual_instance is None:
119
+ return "null"
120
+
121
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
122
+ return self.actual_instance.to_json()
123
+ else:
124
+ return json.dumps(self.actual_instance)
125
+
126
+ def to_dict(self) -> Optional[Union[Dict[str, Any], SearchBulkQuery, SearchStructuredBulkQuery]]:
127
+ """Returns the dict representation of the actual instance"""
128
+ if self.actual_instance is None:
129
+ return None
130
+
131
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
132
+ return self.actual_instance.to_dict()
133
+ else:
134
+ # primitive type
135
+ return self.actual_instance
136
+
137
+ def to_str(self) -> str:
138
+ """Returns the string representation of the actual instance"""
139
+ return pprint.pformat(self.model_dump())
140
+
141
+
@@ -0,0 +1,134 @@
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: 6.6.2
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 typing_extensions import Annotated
24
+ from stadiamaps.models.pelias_layer import PeliasLayer
25
+ from stadiamaps.models.pelias_source import PeliasSource
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+
29
+ class SearchQuery(BaseModel):
30
+ """
31
+ SearchQuery
32
+ """ # noqa: E501
33
+ text: Optional[StrictStr] = Field(default=None, description="The place name (address, venue name, etc.) to search for.")
34
+ focus_point_lat: Optional[Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]]] = Field(default=None, description="The latitude of the point to focus the search on. This will bias results toward the focus point. Requires `focus.point.lon`.", alias="focus.point.lat")
35
+ focus_point_lon: Optional[Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]]] = Field(default=None, description="The longitude of the point to focus the search on. This will bias results toward the focus point. Requires `focus.point.lat`.", alias="focus.point.lon")
36
+ boundary_rect_min_lat: Optional[Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]]] = Field(default=None, description="Defines the min latitude component of a bounding box to limit the search to. Requires all other `boundary.rect` parameters to be specified.", alias="boundary.rect.min_lat")
37
+ boundary_rect_max_lat: Optional[Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]]] = Field(default=None, description="Defines the max latitude component of a bounding box to limit the search to. Requires all other `boundary.rect` parameters to be specified.", alias="boundary.rect.max_lat")
38
+ boundary_rect_min_lon: Optional[Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]]] = Field(default=None, description="Defines the min longitude component of a bounding box to limit the search to. Requires all other `boundary.rect` parameters to be specified.", alias="boundary.rect.min_lon")
39
+ boundary_rect_max_lon: Optional[Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]]] = Field(default=None, description="Defines the max longitude component of a bounding box to limit the search to. Requires all other `boundary.rect` parameters to be specified.", alias="boundary.rect.max_lon")
40
+ boundary_circle_lat: Optional[Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]]] = Field(default=None, description="The latitude of the center of a circle to limit the search to. Requires `boundary.circle.lon`.", alias="boundary.circle.lat")
41
+ boundary_circle_lon: Optional[Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]]] = Field(default=None, description="The longitude of the center of a circle to limit the search to. Requires `boundary.circle.lat`.", alias="boundary.circle.lon")
42
+ boundary_circle_radius: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The radius of the circle (in kilometers) to limit the search to. Defaults to 50km if unspecified.", alias="boundary.circle.radius")
43
+ boundary_country: Optional[List[StrictStr]] = Field(default=None, description="A list of countries to limit the search to. These may be either full names (ex: Canada), or an ISO 3116-1 alpha-2 or alpha-3 code. Prefer ISO codes when possible.", alias="boundary.country")
44
+ boundary_gid: Optional[StrictStr] = Field(default=None, description="The Pelias GID of an area to limit the search to.", alias="boundary.gid")
45
+ layers: Optional[List[PeliasLayer]] = Field(default=None, description="A list of layers to limit the search to.")
46
+ sources: Optional[List[PeliasSource]] = Field(default=None, description="A list of sources to limit the search to.")
47
+ size: Optional[StrictInt] = Field(default=None, description="The maximum number of results to return.")
48
+ lang: Optional[StrictStr] = Field(default=None, description="A BCP47 language tag which specifies a preference for localization of results. By default, results are in the default locale of the source data, but specifying a language will attempt to localize the results. Note that while a `langtag` (in RFC 5646 terms) can contain script, region, etc., only the `language` portion, an ISO 639 code, will be considered. So `en-US` and `en-GB` will both be treated as English.")
49
+ additional_properties: Dict[str, Any] = {}
50
+ __properties: ClassVar[List[str]] = ["text", "focus.point.lat", "focus.point.lon", "boundary.rect.min_lat", "boundary.rect.max_lat", "boundary.rect.min_lon", "boundary.rect.max_lon", "boundary.circle.lat", "boundary.circle.lon", "boundary.circle.radius", "boundary.country", "boundary.gid", "layers", "sources", "size", "lang"]
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ )
57
+
58
+
59
+ def to_str(self) -> str:
60
+ """Returns the string representation of the model using alias"""
61
+ return pprint.pformat(self.model_dump(by_alias=True))
62
+
63
+ def to_json(self) -> str:
64
+ """Returns the JSON representation of the model using alias"""
65
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
+ return json.dumps(self.to_dict())
67
+
68
+ @classmethod
69
+ def from_json(cls, json_str: str) -> Optional[Self]:
70
+ """Create an instance of SearchQuery from a JSON string"""
71
+ return cls.from_dict(json.loads(json_str))
72
+
73
+ def to_dict(self) -> Dict[str, Any]:
74
+ """Return the dictionary representation of the model using alias.
75
+
76
+ This has the following differences from calling pydantic's
77
+ `self.model_dump(by_alias=True)`:
78
+
79
+ * `None` is only added to the output dict for nullable fields that
80
+ were set at model initialization. Other fields with value `None`
81
+ are ignored.
82
+ * Fields in `self.additional_properties` are added to the output dict.
83
+ """
84
+ excluded_fields: Set[str] = set([
85
+ "additional_properties",
86
+ ])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ # puts key-value pairs in additional_properties in the top level
94
+ if self.additional_properties is not None:
95
+ for _key, _value in self.additional_properties.items():
96
+ _dict[_key] = _value
97
+
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of SearchQuery from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate({
110
+ "text": obj.get("text"),
111
+ "focus.point.lat": obj.get("focus.point.lat"),
112
+ "focus.point.lon": obj.get("focus.point.lon"),
113
+ "boundary.rect.min_lat": obj.get("boundary.rect.min_lat"),
114
+ "boundary.rect.max_lat": obj.get("boundary.rect.max_lat"),
115
+ "boundary.rect.min_lon": obj.get("boundary.rect.min_lon"),
116
+ "boundary.rect.max_lon": obj.get("boundary.rect.max_lon"),
117
+ "boundary.circle.lat": obj.get("boundary.circle.lat"),
118
+ "boundary.circle.lon": obj.get("boundary.circle.lon"),
119
+ "boundary.circle.radius": obj.get("boundary.circle.radius"),
120
+ "boundary.country": obj.get("boundary.country"),
121
+ "boundary.gid": obj.get("boundary.gid"),
122
+ "layers": obj.get("layers"),
123
+ "sources": obj.get("sources"),
124
+ "size": obj.get("size"),
125
+ "lang": obj.get("lang")
126
+ })
127
+ # store additional fields in additional_properties
128
+ for _key in obj.keys():
129
+ if _key not in cls.__properties:
130
+ _obj.additional_properties[_key] = obj.get(_key)
131
+
132
+ return _obj
133
+
134
+
@@ -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: 6.6.2
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 stadiamaps.models.search_structured_query import SearchStructuredQuery
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class SearchStructuredBulkQuery(BaseModel):
28
+ """
29
+ SearchStructuredBulkQuery
30
+ """ # noqa: E501
31
+ endpoint: Optional[StrictStr] = None
32
+ query: Optional[SearchStructuredQuery] = None
33
+ additional_properties: Dict[str, Any] = {}
34
+ __properties: ClassVar[List[str]] = ["endpoint", "query"]
35
+
36
+ @field_validator('endpoint')
37
+ def endpoint_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value is None:
40
+ return value
41
+
42
+ if value not in set(['/v1/search/structured']):
43
+ raise ValueError("must be one of enum values ('/v1/search/structured')")
44
+ return value
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+
53
+ def to_str(self) -> str:
54
+ """Returns the string representation of the model using alias"""
55
+ return pprint.pformat(self.model_dump(by_alias=True))
56
+
57
+ def to_json(self) -> str:
58
+ """Returns the JSON representation of the model using alias"""
59
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60
+ return json.dumps(self.to_dict())
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
+ """Create an instance of SearchStructuredBulkQuery from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ * Fields in `self.additional_properties` are added to the output dict.
77
+ """
78
+ excluded_fields: Set[str] = set([
79
+ "additional_properties",
80
+ ])
81
+
82
+ _dict = self.model_dump(
83
+ by_alias=True,
84
+ exclude=excluded_fields,
85
+ exclude_none=True,
86
+ )
87
+ # override the default output from pydantic by calling `to_dict()` of query
88
+ if self.query:
89
+ _dict['query'] = self.query.to_dict()
90
+ # puts key-value pairs in additional_properties in the top level
91
+ if self.additional_properties is not None:
92
+ for _key, _value in self.additional_properties.items():
93
+ _dict[_key] = _value
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of SearchStructuredBulkQuery from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate({
107
+ "endpoint": obj.get("endpoint"),
108
+ "query": SearchStructuredQuery.from_dict(obj["query"]) if obj.get("query") 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,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: 6.6.2
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 typing_extensions import Annotated
24
+ from stadiamaps.models.pelias_layer import PeliasLayer
25
+ from stadiamaps.models.pelias_source import PeliasSource
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+
29
+ class SearchStructuredQuery(BaseModel):
30
+ """
31
+ SearchStructuredQuery
32
+ """ # noqa: E501
33
+ address: Optional[StrictStr] = Field(default=None, description="A street name, optionally with a house number.")
34
+ neighbourhood: Optional[StrictStr] = Field(default=None, description="Varies by area, but has a locally specific meaning (NOT always an official administrative unit).")
35
+ borough: Optional[StrictStr] = Field(default=None, description="A unit within a city (not widely used, but present in places like NYC and Mexico City).")
36
+ locality: Optional[StrictStr] = Field(default=None, description="The city, village, town, etc. that the place/address is part of.")
37
+ county: Optional[StrictStr] = Field(default=None, description="Administrative divisions between localities and regions. Not commonly used as input to structured geocoding.")
38
+ region: Optional[StrictStr] = Field(default=None, description="Typically the first administrative division within a country. For example, a US state or a Canadian province.")
39
+ postal_code: Optional[StrictStr] = Field(default=None, description="A mail sorting code.", alias="postalCode")
40
+ country: Optional[StrictStr] = Field(default=None, description="A full name (ex: Canada), or a 2 or 3 character ISO code. Prefer ISO codes when possible.")
41
+ focus_point_lat: Optional[Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]]] = Field(default=None, description="The latitude of the point to focus the search on. This will bias results toward the focus point. Requires `focus.point.lon`.", alias="focus.point.lat")
42
+ focus_point_lon: Optional[Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]]] = Field(default=None, description="The longitude of the point to focus the search on. This will bias results toward the focus point. Requires `focus.point.lat`.", alias="focus.point.lon")
43
+ boundary_rect_min_lat: Optional[Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]]] = Field(default=None, description="Defines the min latitude component of a bounding box to limit the search to. Requires all other `boundary.rect` parameters to be specified.", alias="boundary.rect.min_lat")
44
+ boundary_rect_max_lat: Optional[Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]]] = Field(default=None, description="Defines the max latitude component of a bounding box to limit the search to. Requires all other `boundary.rect` parameters to be specified.", alias="boundary.rect.max_lat")
45
+ boundary_rect_min_lon: Optional[Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]]] = Field(default=None, description="Defines the min longitude component of a bounding box to limit the search to. Requires all other `boundary.rect` parameters to be specified.", alias="boundary.rect.min_lon")
46
+ boundary_rect_max_lon: Optional[Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]]] = Field(default=None, description="Defines the max longitude component of a bounding box to limit the search to. Requires all other `boundary.rect` parameters to be specified.", alias="boundary.rect.max_lon")
47
+ boundary_circle_lat: Optional[Union[Annotated[float, Field(le=90, strict=True, ge=-90)], Annotated[int, Field(le=90, strict=True, ge=-90)]]] = Field(default=None, description="The latitude of the center of a circle to limit the search to. Requires `boundary.circle.lon`.", alias="boundary.circle.lat")
48
+ boundary_circle_lon: Optional[Union[Annotated[float, Field(le=180, strict=True, ge=-180)], Annotated[int, Field(le=180, strict=True, ge=-180)]]] = Field(default=None, description="The longitude of the center of a circle to limit the search to. Requires `boundary.circle.lat`.", alias="boundary.circle.lon")
49
+ boundary_circle_radius: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The radius of the circle (in kilometers) to limit the search to. Defaults to 50km if unspecified.", alias="boundary.circle.radius")
50
+ boundary_country: Optional[List[StrictStr]] = Field(default=None, description="A list of countries to limit the search to. These may be either full names (ex: Canada), or an ISO 3116-1 alpha-2 or alpha-3 code. Prefer ISO codes when possible.", alias="boundary.country")
51
+ boundary_gid: Optional[StrictStr] = Field(default=None, description="The Pelias GID of an area to limit the search to.", alias="boundary.gid")
52
+ layers: Optional[List[PeliasLayer]] = Field(default=None, description="A list of layers to limit the search to.")
53
+ sources: Optional[List[PeliasSource]] = Field(default=None, description="A list of sources to limit the search to.")
54
+ size: Optional[StrictInt] = Field(default=None, description="The maximum number of results to return.")
55
+ lang: Optional[StrictStr] = Field(default=None, description="A BCP47 language tag which specifies a preference for localization of results. By default, results are in the default locale of the source data, but specifying a language will attempt to localize the results. Note that while a `langtag` (in RFC 5646 terms) can contain script, region, etc., only the `language` portion, an ISO 639 code, will be considered. So `en-US` and `en-GB` will both be treated as English.")
56
+ additional_properties: Dict[str, Any] = {}
57
+ __properties: ClassVar[List[str]] = ["address", "neighbourhood", "borough", "locality", "county", "region", "postalCode", "country", "focus.point.lat", "focus.point.lon", "boundary.rect.min_lat", "boundary.rect.max_lat", "boundary.rect.min_lon", "boundary.rect.max_lon", "boundary.circle.lat", "boundary.circle.lon", "boundary.circle.radius", "boundary.country", "boundary.gid", "layers", "sources", "size", "lang"]
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 SearchStructuredQuery 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
+ # puts key-value pairs in additional_properties in the top level
101
+ if self.additional_properties is not None:
102
+ for _key, _value in self.additional_properties.items():
103
+ _dict[_key] = _value
104
+
105
+ return _dict
106
+
107
+ @classmethod
108
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
109
+ """Create an instance of SearchStructuredQuery from a dict"""
110
+ if obj is None:
111
+ return None
112
+
113
+ if not isinstance(obj, dict):
114
+ return cls.model_validate(obj)
115
+
116
+ _obj = cls.model_validate({
117
+ "address": obj.get("address"),
118
+ "neighbourhood": obj.get("neighbourhood"),
119
+ "borough": obj.get("borough"),
120
+ "locality": obj.get("locality"),
121
+ "county": obj.get("county"),
122
+ "region": obj.get("region"),
123
+ "postalCode": obj.get("postalCode"),
124
+ "country": obj.get("country"),
125
+ "focus.point.lat": obj.get("focus.point.lat"),
126
+ "focus.point.lon": obj.get("focus.point.lon"),
127
+ "boundary.rect.min_lat": obj.get("boundary.rect.min_lat"),
128
+ "boundary.rect.max_lat": obj.get("boundary.rect.max_lat"),
129
+ "boundary.rect.min_lon": obj.get("boundary.rect.min_lon"),
130
+ "boundary.rect.max_lon": obj.get("boundary.rect.max_lon"),
131
+ "boundary.circle.lat": obj.get("boundary.circle.lat"),
132
+ "boundary.circle.lon": obj.get("boundary.circle.lon"),
133
+ "boundary.circle.radius": obj.get("boundary.circle.radius"),
134
+ "boundary.country": obj.get("boundary.country"),
135
+ "boundary.gid": obj.get("boundary.gid"),
136
+ "layers": obj.get("layers"),
137
+ "sources": obj.get("sources"),
138
+ "size": obj.get("size"),
139
+ "lang": obj.get("lang")
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
+
@@ -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.3.0
8
+ The version of the OpenAPI document: 6.6.2
9
9
  Contact: support@stadiamaps.com
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11