permitstack 1.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 (68) hide show
  1. permitstack/__init__.py +17 -0
  2. permitstack/_hooks/__init__.py +4 -0
  3. permitstack/_hooks/sdkhooks.py +74 -0
  4. permitstack/_hooks/types.py +112 -0
  5. permitstack/_version.py +15 -0
  6. permitstack/basesdk.py +396 -0
  7. permitstack/bulk_export.py +241 -0
  8. permitstack/contractors.py +625 -0
  9. permitstack/errors/__init__.py +39 -0
  10. permitstack/errors/httpvalidationerror.py +28 -0
  11. permitstack/errors/no_response_error.py +17 -0
  12. permitstack/errors/permitstackdefaulterror.py +40 -0
  13. permitstack/errors/permitstackerror.py +30 -0
  14. permitstack/errors/responsevalidationerror.py +27 -0
  15. permitstack/health.py +171 -0
  16. permitstack/httpclient.py +125 -0
  17. permitstack/models/__init__.py +158 -0
  18. permitstack/models/contractorprofile.py +108 -0
  19. permitstack/models/contractorsearchresponse.py +24 -0
  20. permitstack/models/contractorsummary.py +57 -0
  21. permitstack/models/delete_webhookop.py +16 -0
  22. permitstack/models/export_permits_csvop.py +98 -0
  23. permitstack/models/get_contractor_permitsop.py +46 -0
  24. permitstack/models/get_contractorop.py +16 -0
  25. permitstack/models/get_permitop.py +16 -0
  26. permitstack/models/get_permits_by_addressop.py +46 -0
  27. permitstack/models/get_property_historyop.py +18 -0
  28. permitstack/models/permitcategory.py +27 -0
  29. permitstack/models/permitdetail.py +164 -0
  30. permitstack/models/permitsearchresponse.py +24 -0
  31. permitstack/models/permitstatus.py +16 -0
  32. permitstack/models/permitsummary.py +121 -0
  33. permitstack/models/propertytype.py +14 -0
  34. permitstack/models/search_contractorsop.py +98 -0
  35. permitstack/models/search_permitsop.py +247 -0
  36. permitstack/models/security.py +42 -0
  37. permitstack/models/validationerror.py +57 -0
  38. permitstack/models/webhookcreate.py +60 -0
  39. permitstack/permits.py +866 -0
  40. permitstack/property_history.py +207 -0
  41. permitstack/py.typed +1 -0
  42. permitstack/sdk.py +218 -0
  43. permitstack/sdkconfiguration.py +49 -0
  44. permitstack/types/__init__.py +21 -0
  45. permitstack/types/basemodel.py +77 -0
  46. permitstack/utils/__init__.py +178 -0
  47. permitstack/utils/annotations.py +79 -0
  48. permitstack/utils/datetimes.py +23 -0
  49. permitstack/utils/dynamic_imports.py +54 -0
  50. permitstack/utils/enums.py +134 -0
  51. permitstack/utils/eventstreaming.py +309 -0
  52. permitstack/utils/forms.py +234 -0
  53. permitstack/utils/headers.py +136 -0
  54. permitstack/utils/logger.py +27 -0
  55. permitstack/utils/metadata.py +119 -0
  56. permitstack/utils/queryparams.py +217 -0
  57. permitstack/utils/requestbodies.py +66 -0
  58. permitstack/utils/retries.py +271 -0
  59. permitstack/utils/security.py +215 -0
  60. permitstack/utils/serializers.py +225 -0
  61. permitstack/utils/unmarshal_json_response.py +38 -0
  62. permitstack/utils/url.py +155 -0
  63. permitstack/utils/values.py +137 -0
  64. permitstack/webhooks.py +593 -0
  65. permitstack-1.0.0.dist-info/METADATA +541 -0
  66. permitstack-1.0.0.dist-info/RECORD +68 -0
  67. permitstack-1.0.0.dist-info/WHEEL +5 -0
  68. permitstack-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,241 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from permitstack import errors, models, utils
5
+ from permitstack._hooks import HookContext
6
+ from permitstack.types import OptionalNullable, UNSET
7
+ from permitstack.utils import get_security_from_env
8
+ from permitstack.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Any, Mapping, Optional
10
+
11
+
12
+ class BulkExport(BaseSDK):
13
+ r"""Export permit data in bulk (CSV)"""
14
+
15
+ def export_permits_csv(
16
+ self,
17
+ *,
18
+ city: OptionalNullable[str] = UNSET,
19
+ state: OptionalNullable[str] = UNSET,
20
+ category: OptionalNullable[str] = UNSET,
21
+ zip_code: OptionalNullable[str] = UNSET,
22
+ filed_after: OptionalNullable[str] = UNSET,
23
+ filed_before: OptionalNullable[str] = UNSET,
24
+ limit: Optional[int] = 10000,
25
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
26
+ server_url: Optional[str] = None,
27
+ timeout_ms: Optional[int] = None,
28
+ http_headers: Optional[Mapping[str, str]] = None,
29
+ ) -> Any:
30
+ r"""Export Permits Csv
31
+
32
+ Export permits as CSV. Available to Pro and Enterprise tiers only.
33
+
34
+ Maximum 50,000 rows per export. Use filters to narrow your results.
35
+
36
+ :param city:
37
+ :param state:
38
+ :param category:
39
+ :param zip_code:
40
+ :param filed_after:
41
+ :param filed_before:
42
+ :param limit:
43
+ :param retries: Override the default retry configuration for this method
44
+ :param server_url: Override the default server URL for this method
45
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
46
+ :param http_headers: Additional headers to set or replace on requests.
47
+ """
48
+ base_url = None
49
+ url_variables = None
50
+ if timeout_ms is None:
51
+ timeout_ms = self.sdk_configuration.timeout_ms
52
+
53
+ if server_url is not None:
54
+ base_url = server_url
55
+ else:
56
+ base_url = self._get_url(base_url, url_variables)
57
+
58
+ request = models.ExportPermitsCsvRequest(
59
+ city=city,
60
+ state=state,
61
+ category=category,
62
+ zip_code=zip_code,
63
+ filed_after=filed_after,
64
+ filed_before=filed_before,
65
+ limit=limit,
66
+ )
67
+
68
+ req = self._build_request(
69
+ method="GET",
70
+ path="/v1/bulk/export",
71
+ base_url=base_url,
72
+ url_variables=url_variables,
73
+ request=request,
74
+ request_body_required=False,
75
+ request_has_path_params=False,
76
+ request_has_query_params=True,
77
+ user_agent_header="user-agent",
78
+ accept_header_value="application/json",
79
+ http_headers=http_headers,
80
+ security=self.sdk_configuration.security,
81
+ allow_empty_value=None,
82
+ timeout_ms=timeout_ms,
83
+ )
84
+
85
+ if retries == UNSET:
86
+ if self.sdk_configuration.retry_config is not UNSET:
87
+ retries = self.sdk_configuration.retry_config
88
+
89
+ retry_config = None
90
+ if isinstance(retries, utils.RetryConfig):
91
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
92
+
93
+ http_res = self.do_request(
94
+ hook_ctx=HookContext(
95
+ config=self.sdk_configuration,
96
+ base_url=base_url or "",
97
+ operation_id="export_permits_csv",
98
+ oauth2_scopes=None,
99
+ security_source=get_security_from_env(
100
+ self.sdk_configuration.security, models.Security
101
+ ),
102
+ ),
103
+ request=req,
104
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
105
+ retry_config=retry_config,
106
+ )
107
+
108
+ response_data: Any = None
109
+ if utils.match_response(http_res, "200", "application/json"):
110
+ return unmarshal_json_response(Any, http_res)
111
+ if utils.match_response(http_res, "422", "application/json"):
112
+ response_data = unmarshal_json_response(
113
+ errors.HTTPValidationErrorData, http_res
114
+ )
115
+ raise errors.HTTPValidationError(response_data, http_res)
116
+ if utils.match_response(http_res, "4XX", "*"):
117
+ http_res_text = utils.stream_to_text(http_res)
118
+ raise errors.PermitstackDefaultError(
119
+ "API error occurred", http_res, http_res_text
120
+ )
121
+ if utils.match_response(http_res, "5XX", "*"):
122
+ http_res_text = utils.stream_to_text(http_res)
123
+ raise errors.PermitstackDefaultError(
124
+ "API error occurred", http_res, http_res_text
125
+ )
126
+
127
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)
128
+
129
+ async def export_permits_csv_async(
130
+ self,
131
+ *,
132
+ city: OptionalNullable[str] = UNSET,
133
+ state: OptionalNullable[str] = UNSET,
134
+ category: OptionalNullable[str] = UNSET,
135
+ zip_code: OptionalNullable[str] = UNSET,
136
+ filed_after: OptionalNullable[str] = UNSET,
137
+ filed_before: OptionalNullable[str] = UNSET,
138
+ limit: Optional[int] = 10000,
139
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
140
+ server_url: Optional[str] = None,
141
+ timeout_ms: Optional[int] = None,
142
+ http_headers: Optional[Mapping[str, str]] = None,
143
+ ) -> Any:
144
+ r"""Export Permits Csv
145
+
146
+ Export permits as CSV. Available to Pro and Enterprise tiers only.
147
+
148
+ Maximum 50,000 rows per export. Use filters to narrow your results.
149
+
150
+ :param city:
151
+ :param state:
152
+ :param category:
153
+ :param zip_code:
154
+ :param filed_after:
155
+ :param filed_before:
156
+ :param limit:
157
+ :param retries: Override the default retry configuration for this method
158
+ :param server_url: Override the default server URL for this method
159
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
160
+ :param http_headers: Additional headers to set or replace on requests.
161
+ """
162
+ base_url = None
163
+ url_variables = None
164
+ if timeout_ms is None:
165
+ timeout_ms = self.sdk_configuration.timeout_ms
166
+
167
+ if server_url is not None:
168
+ base_url = server_url
169
+ else:
170
+ base_url = self._get_url(base_url, url_variables)
171
+
172
+ request = models.ExportPermitsCsvRequest(
173
+ city=city,
174
+ state=state,
175
+ category=category,
176
+ zip_code=zip_code,
177
+ filed_after=filed_after,
178
+ filed_before=filed_before,
179
+ limit=limit,
180
+ )
181
+
182
+ req = self._build_request_async(
183
+ method="GET",
184
+ path="/v1/bulk/export",
185
+ base_url=base_url,
186
+ url_variables=url_variables,
187
+ request=request,
188
+ request_body_required=False,
189
+ request_has_path_params=False,
190
+ request_has_query_params=True,
191
+ user_agent_header="user-agent",
192
+ accept_header_value="application/json",
193
+ http_headers=http_headers,
194
+ security=self.sdk_configuration.security,
195
+ allow_empty_value=None,
196
+ timeout_ms=timeout_ms,
197
+ )
198
+
199
+ if retries == UNSET:
200
+ if self.sdk_configuration.retry_config is not UNSET:
201
+ retries = self.sdk_configuration.retry_config
202
+
203
+ retry_config = None
204
+ if isinstance(retries, utils.RetryConfig):
205
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
206
+
207
+ http_res = await self.do_request_async(
208
+ hook_ctx=HookContext(
209
+ config=self.sdk_configuration,
210
+ base_url=base_url or "",
211
+ operation_id="export_permits_csv",
212
+ oauth2_scopes=None,
213
+ security_source=get_security_from_env(
214
+ self.sdk_configuration.security, models.Security
215
+ ),
216
+ ),
217
+ request=req,
218
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
219
+ retry_config=retry_config,
220
+ )
221
+
222
+ response_data: Any = None
223
+ if utils.match_response(http_res, "200", "application/json"):
224
+ return unmarshal_json_response(Any, http_res)
225
+ if utils.match_response(http_res, "422", "application/json"):
226
+ response_data = unmarshal_json_response(
227
+ errors.HTTPValidationErrorData, http_res
228
+ )
229
+ raise errors.HTTPValidationError(response_data, http_res)
230
+ if utils.match_response(http_res, "4XX", "*"):
231
+ http_res_text = await utils.stream_to_text_async(http_res)
232
+ raise errors.PermitstackDefaultError(
233
+ "API error occurred", http_res, http_res_text
234
+ )
235
+ if utils.match_response(http_res, "5XX", "*"):
236
+ http_res_text = await utils.stream_to_text_async(http_res)
237
+ raise errors.PermitstackDefaultError(
238
+ "API error occurred", http_res, http_res_text
239
+ )
240
+
241
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)