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.
- permitstack/__init__.py +17 -0
- permitstack/_hooks/__init__.py +4 -0
- permitstack/_hooks/sdkhooks.py +74 -0
- permitstack/_hooks/types.py +112 -0
- permitstack/_version.py +15 -0
- permitstack/basesdk.py +396 -0
- permitstack/bulk_export.py +241 -0
- permitstack/contractors.py +625 -0
- permitstack/errors/__init__.py +39 -0
- permitstack/errors/httpvalidationerror.py +28 -0
- permitstack/errors/no_response_error.py +17 -0
- permitstack/errors/permitstackdefaulterror.py +40 -0
- permitstack/errors/permitstackerror.py +30 -0
- permitstack/errors/responsevalidationerror.py +27 -0
- permitstack/health.py +171 -0
- permitstack/httpclient.py +125 -0
- permitstack/models/__init__.py +158 -0
- permitstack/models/contractorprofile.py +108 -0
- permitstack/models/contractorsearchresponse.py +24 -0
- permitstack/models/contractorsummary.py +57 -0
- permitstack/models/delete_webhookop.py +16 -0
- permitstack/models/export_permits_csvop.py +98 -0
- permitstack/models/get_contractor_permitsop.py +46 -0
- permitstack/models/get_contractorop.py +16 -0
- permitstack/models/get_permitop.py +16 -0
- permitstack/models/get_permits_by_addressop.py +46 -0
- permitstack/models/get_property_historyop.py +18 -0
- permitstack/models/permitcategory.py +27 -0
- permitstack/models/permitdetail.py +164 -0
- permitstack/models/permitsearchresponse.py +24 -0
- permitstack/models/permitstatus.py +16 -0
- permitstack/models/permitsummary.py +121 -0
- permitstack/models/propertytype.py +14 -0
- permitstack/models/search_contractorsop.py +98 -0
- permitstack/models/search_permitsop.py +247 -0
- permitstack/models/security.py +42 -0
- permitstack/models/validationerror.py +57 -0
- permitstack/models/webhookcreate.py +60 -0
- permitstack/permits.py +866 -0
- permitstack/property_history.py +207 -0
- permitstack/py.typed +1 -0
- permitstack/sdk.py +218 -0
- permitstack/sdkconfiguration.py +49 -0
- permitstack/types/__init__.py +21 -0
- permitstack/types/basemodel.py +77 -0
- permitstack/utils/__init__.py +178 -0
- permitstack/utils/annotations.py +79 -0
- permitstack/utils/datetimes.py +23 -0
- permitstack/utils/dynamic_imports.py +54 -0
- permitstack/utils/enums.py +134 -0
- permitstack/utils/eventstreaming.py +309 -0
- permitstack/utils/forms.py +234 -0
- permitstack/utils/headers.py +136 -0
- permitstack/utils/logger.py +27 -0
- permitstack/utils/metadata.py +119 -0
- permitstack/utils/queryparams.py +217 -0
- permitstack/utils/requestbodies.py +66 -0
- permitstack/utils/retries.py +271 -0
- permitstack/utils/security.py +215 -0
- permitstack/utils/serializers.py +225 -0
- permitstack/utils/unmarshal_json_response.py +38 -0
- permitstack/utils/url.py +155 -0
- permitstack/utils/values.py +137 -0
- permitstack/webhooks.py +593 -0
- permitstack-1.0.0.dist-info/METADATA +541 -0
- permitstack-1.0.0.dist-info/RECORD +68 -0
- permitstack-1.0.0.dist-info/WHEEL +5 -0
- permitstack-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,625 @@
|
|
|
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 Contractors(BaseSDK):
|
|
13
|
+
r"""Search contractors and see their permit history"""
|
|
14
|
+
|
|
15
|
+
def search_contractors(
|
|
16
|
+
self,
|
|
17
|
+
*,
|
|
18
|
+
name: OptionalNullable[str] = UNSET,
|
|
19
|
+
state: OptionalNullable[str] = UNSET,
|
|
20
|
+
city: OptionalNullable[str] = UNSET,
|
|
21
|
+
specialty: OptionalNullable[str] = UNSET,
|
|
22
|
+
min_permits: OptionalNullable[int] = UNSET,
|
|
23
|
+
page: Optional[int] = 1,
|
|
24
|
+
per_page: Optional[int] = 25,
|
|
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
|
+
) -> models.ContractorSearchResponse:
|
|
30
|
+
r"""Search Contractors
|
|
31
|
+
|
|
32
|
+
Search contractors by name, location, or specialty.
|
|
33
|
+
|
|
34
|
+
:param name: Contractor name (partial match)
|
|
35
|
+
:param state: 2-letter state code
|
|
36
|
+
:param city: City name
|
|
37
|
+
:param specialty: Specialty tag (e.g. solar, roofing, hvac)
|
|
38
|
+
:param min_permits: Minimum total permits
|
|
39
|
+
:param page:
|
|
40
|
+
:param per_page:
|
|
41
|
+
:param retries: Override the default retry configuration for this method
|
|
42
|
+
:param server_url: Override the default server URL for this method
|
|
43
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
44
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
45
|
+
"""
|
|
46
|
+
base_url = None
|
|
47
|
+
url_variables = None
|
|
48
|
+
if timeout_ms is None:
|
|
49
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
50
|
+
|
|
51
|
+
if server_url is not None:
|
|
52
|
+
base_url = server_url
|
|
53
|
+
else:
|
|
54
|
+
base_url = self._get_url(base_url, url_variables)
|
|
55
|
+
|
|
56
|
+
request = models.SearchContractorsRequest(
|
|
57
|
+
name=name,
|
|
58
|
+
state=state,
|
|
59
|
+
city=city,
|
|
60
|
+
specialty=specialty,
|
|
61
|
+
min_permits=min_permits,
|
|
62
|
+
page=page,
|
|
63
|
+
per_page=per_page,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
req = self._build_request(
|
|
67
|
+
method="GET",
|
|
68
|
+
path="/v1/contractors/search",
|
|
69
|
+
base_url=base_url,
|
|
70
|
+
url_variables=url_variables,
|
|
71
|
+
request=request,
|
|
72
|
+
request_body_required=False,
|
|
73
|
+
request_has_path_params=False,
|
|
74
|
+
request_has_query_params=True,
|
|
75
|
+
user_agent_header="user-agent",
|
|
76
|
+
accept_header_value="application/json",
|
|
77
|
+
http_headers=http_headers,
|
|
78
|
+
security=self.sdk_configuration.security,
|
|
79
|
+
allow_empty_value=None,
|
|
80
|
+
timeout_ms=timeout_ms,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if retries == UNSET:
|
|
84
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
85
|
+
retries = self.sdk_configuration.retry_config
|
|
86
|
+
|
|
87
|
+
retry_config = None
|
|
88
|
+
if isinstance(retries, utils.RetryConfig):
|
|
89
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
90
|
+
|
|
91
|
+
http_res = self.do_request(
|
|
92
|
+
hook_ctx=HookContext(
|
|
93
|
+
config=self.sdk_configuration,
|
|
94
|
+
base_url=base_url or "",
|
|
95
|
+
operation_id="search_contractors",
|
|
96
|
+
oauth2_scopes=None,
|
|
97
|
+
security_source=get_security_from_env(
|
|
98
|
+
self.sdk_configuration.security, models.Security
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
request=req,
|
|
102
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
103
|
+
retry_config=retry_config,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response_data: Any = None
|
|
107
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
108
|
+
return unmarshal_json_response(models.ContractorSearchResponse, http_res)
|
|
109
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
110
|
+
response_data = unmarshal_json_response(
|
|
111
|
+
errors.HTTPValidationErrorData, http_res
|
|
112
|
+
)
|
|
113
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
114
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
115
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
116
|
+
raise errors.PermitstackDefaultError(
|
|
117
|
+
"API error occurred", http_res, http_res_text
|
|
118
|
+
)
|
|
119
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
120
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
121
|
+
raise errors.PermitstackDefaultError(
|
|
122
|
+
"API error occurred", http_res, http_res_text
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
126
|
+
|
|
127
|
+
async def search_contractors_async(
|
|
128
|
+
self,
|
|
129
|
+
*,
|
|
130
|
+
name: OptionalNullable[str] = UNSET,
|
|
131
|
+
state: OptionalNullable[str] = UNSET,
|
|
132
|
+
city: OptionalNullable[str] = UNSET,
|
|
133
|
+
specialty: OptionalNullable[str] = UNSET,
|
|
134
|
+
min_permits: OptionalNullable[int] = UNSET,
|
|
135
|
+
page: Optional[int] = 1,
|
|
136
|
+
per_page: Optional[int] = 25,
|
|
137
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
138
|
+
server_url: Optional[str] = None,
|
|
139
|
+
timeout_ms: Optional[int] = None,
|
|
140
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
141
|
+
) -> models.ContractorSearchResponse:
|
|
142
|
+
r"""Search Contractors
|
|
143
|
+
|
|
144
|
+
Search contractors by name, location, or specialty.
|
|
145
|
+
|
|
146
|
+
:param name: Contractor name (partial match)
|
|
147
|
+
:param state: 2-letter state code
|
|
148
|
+
:param city: City name
|
|
149
|
+
:param specialty: Specialty tag (e.g. solar, roofing, hvac)
|
|
150
|
+
:param min_permits: Minimum total permits
|
|
151
|
+
:param page:
|
|
152
|
+
:param per_page:
|
|
153
|
+
:param retries: Override the default retry configuration for this method
|
|
154
|
+
:param server_url: Override the default server URL for this method
|
|
155
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
156
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
157
|
+
"""
|
|
158
|
+
base_url = None
|
|
159
|
+
url_variables = None
|
|
160
|
+
if timeout_ms is None:
|
|
161
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
162
|
+
|
|
163
|
+
if server_url is not None:
|
|
164
|
+
base_url = server_url
|
|
165
|
+
else:
|
|
166
|
+
base_url = self._get_url(base_url, url_variables)
|
|
167
|
+
|
|
168
|
+
request = models.SearchContractorsRequest(
|
|
169
|
+
name=name,
|
|
170
|
+
state=state,
|
|
171
|
+
city=city,
|
|
172
|
+
specialty=specialty,
|
|
173
|
+
min_permits=min_permits,
|
|
174
|
+
page=page,
|
|
175
|
+
per_page=per_page,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
req = self._build_request_async(
|
|
179
|
+
method="GET",
|
|
180
|
+
path="/v1/contractors/search",
|
|
181
|
+
base_url=base_url,
|
|
182
|
+
url_variables=url_variables,
|
|
183
|
+
request=request,
|
|
184
|
+
request_body_required=False,
|
|
185
|
+
request_has_path_params=False,
|
|
186
|
+
request_has_query_params=True,
|
|
187
|
+
user_agent_header="user-agent",
|
|
188
|
+
accept_header_value="application/json",
|
|
189
|
+
http_headers=http_headers,
|
|
190
|
+
security=self.sdk_configuration.security,
|
|
191
|
+
allow_empty_value=None,
|
|
192
|
+
timeout_ms=timeout_ms,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
if retries == UNSET:
|
|
196
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
197
|
+
retries = self.sdk_configuration.retry_config
|
|
198
|
+
|
|
199
|
+
retry_config = None
|
|
200
|
+
if isinstance(retries, utils.RetryConfig):
|
|
201
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
202
|
+
|
|
203
|
+
http_res = await self.do_request_async(
|
|
204
|
+
hook_ctx=HookContext(
|
|
205
|
+
config=self.sdk_configuration,
|
|
206
|
+
base_url=base_url or "",
|
|
207
|
+
operation_id="search_contractors",
|
|
208
|
+
oauth2_scopes=None,
|
|
209
|
+
security_source=get_security_from_env(
|
|
210
|
+
self.sdk_configuration.security, models.Security
|
|
211
|
+
),
|
|
212
|
+
),
|
|
213
|
+
request=req,
|
|
214
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
215
|
+
retry_config=retry_config,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
response_data: Any = None
|
|
219
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
220
|
+
return unmarshal_json_response(models.ContractorSearchResponse, http_res)
|
|
221
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
222
|
+
response_data = unmarshal_json_response(
|
|
223
|
+
errors.HTTPValidationErrorData, http_res
|
|
224
|
+
)
|
|
225
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
226
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
227
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
228
|
+
raise errors.PermitstackDefaultError(
|
|
229
|
+
"API error occurred", http_res, http_res_text
|
|
230
|
+
)
|
|
231
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
232
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
233
|
+
raise errors.PermitstackDefaultError(
|
|
234
|
+
"API error occurred", http_res, http_res_text
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
238
|
+
|
|
239
|
+
def get_contractor(
|
|
240
|
+
self,
|
|
241
|
+
*,
|
|
242
|
+
contractor_id: str,
|
|
243
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
244
|
+
server_url: Optional[str] = None,
|
|
245
|
+
timeout_ms: Optional[int] = None,
|
|
246
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
247
|
+
) -> models.ContractorProfile:
|
|
248
|
+
r"""Get Contractor
|
|
249
|
+
|
|
250
|
+
Get a contractor's full profile with permit stats.
|
|
251
|
+
|
|
252
|
+
:param contractor_id:
|
|
253
|
+
:param retries: Override the default retry configuration for this method
|
|
254
|
+
:param server_url: Override the default server URL for this method
|
|
255
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
256
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
257
|
+
"""
|
|
258
|
+
base_url = None
|
|
259
|
+
url_variables = None
|
|
260
|
+
if timeout_ms is None:
|
|
261
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
262
|
+
|
|
263
|
+
if server_url is not None:
|
|
264
|
+
base_url = server_url
|
|
265
|
+
else:
|
|
266
|
+
base_url = self._get_url(base_url, url_variables)
|
|
267
|
+
|
|
268
|
+
request = models.GetContractorRequest(
|
|
269
|
+
contractor_id=contractor_id,
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
req = self._build_request(
|
|
273
|
+
method="GET",
|
|
274
|
+
path="/v1/contractors/{contractor_id}",
|
|
275
|
+
base_url=base_url,
|
|
276
|
+
url_variables=url_variables,
|
|
277
|
+
request=request,
|
|
278
|
+
request_body_required=False,
|
|
279
|
+
request_has_path_params=True,
|
|
280
|
+
request_has_query_params=True,
|
|
281
|
+
user_agent_header="user-agent",
|
|
282
|
+
accept_header_value="application/json",
|
|
283
|
+
http_headers=http_headers,
|
|
284
|
+
security=self.sdk_configuration.security,
|
|
285
|
+
allow_empty_value=None,
|
|
286
|
+
timeout_ms=timeout_ms,
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
if retries == UNSET:
|
|
290
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
291
|
+
retries = self.sdk_configuration.retry_config
|
|
292
|
+
|
|
293
|
+
retry_config = None
|
|
294
|
+
if isinstance(retries, utils.RetryConfig):
|
|
295
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
296
|
+
|
|
297
|
+
http_res = self.do_request(
|
|
298
|
+
hook_ctx=HookContext(
|
|
299
|
+
config=self.sdk_configuration,
|
|
300
|
+
base_url=base_url or "",
|
|
301
|
+
operation_id="get_contractor",
|
|
302
|
+
oauth2_scopes=None,
|
|
303
|
+
security_source=get_security_from_env(
|
|
304
|
+
self.sdk_configuration.security, models.Security
|
|
305
|
+
),
|
|
306
|
+
),
|
|
307
|
+
request=req,
|
|
308
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
309
|
+
retry_config=retry_config,
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
response_data: Any = None
|
|
313
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
314
|
+
return unmarshal_json_response(models.ContractorProfile, http_res)
|
|
315
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
316
|
+
response_data = unmarshal_json_response(
|
|
317
|
+
errors.HTTPValidationErrorData, http_res
|
|
318
|
+
)
|
|
319
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
320
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
321
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
322
|
+
raise errors.PermitstackDefaultError(
|
|
323
|
+
"API error occurred", http_res, http_res_text
|
|
324
|
+
)
|
|
325
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
326
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
327
|
+
raise errors.PermitstackDefaultError(
|
|
328
|
+
"API error occurred", http_res, http_res_text
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
332
|
+
|
|
333
|
+
async def get_contractor_async(
|
|
334
|
+
self,
|
|
335
|
+
*,
|
|
336
|
+
contractor_id: str,
|
|
337
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
338
|
+
server_url: Optional[str] = None,
|
|
339
|
+
timeout_ms: Optional[int] = None,
|
|
340
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
341
|
+
) -> models.ContractorProfile:
|
|
342
|
+
r"""Get Contractor
|
|
343
|
+
|
|
344
|
+
Get a contractor's full profile with permit stats.
|
|
345
|
+
|
|
346
|
+
:param contractor_id:
|
|
347
|
+
:param retries: Override the default retry configuration for this method
|
|
348
|
+
:param server_url: Override the default server URL for this method
|
|
349
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
350
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
351
|
+
"""
|
|
352
|
+
base_url = None
|
|
353
|
+
url_variables = None
|
|
354
|
+
if timeout_ms is None:
|
|
355
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
356
|
+
|
|
357
|
+
if server_url is not None:
|
|
358
|
+
base_url = server_url
|
|
359
|
+
else:
|
|
360
|
+
base_url = self._get_url(base_url, url_variables)
|
|
361
|
+
|
|
362
|
+
request = models.GetContractorRequest(
|
|
363
|
+
contractor_id=contractor_id,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
req = self._build_request_async(
|
|
367
|
+
method="GET",
|
|
368
|
+
path="/v1/contractors/{contractor_id}",
|
|
369
|
+
base_url=base_url,
|
|
370
|
+
url_variables=url_variables,
|
|
371
|
+
request=request,
|
|
372
|
+
request_body_required=False,
|
|
373
|
+
request_has_path_params=True,
|
|
374
|
+
request_has_query_params=True,
|
|
375
|
+
user_agent_header="user-agent",
|
|
376
|
+
accept_header_value="application/json",
|
|
377
|
+
http_headers=http_headers,
|
|
378
|
+
security=self.sdk_configuration.security,
|
|
379
|
+
allow_empty_value=None,
|
|
380
|
+
timeout_ms=timeout_ms,
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
if retries == UNSET:
|
|
384
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
385
|
+
retries = self.sdk_configuration.retry_config
|
|
386
|
+
|
|
387
|
+
retry_config = None
|
|
388
|
+
if isinstance(retries, utils.RetryConfig):
|
|
389
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
390
|
+
|
|
391
|
+
http_res = await self.do_request_async(
|
|
392
|
+
hook_ctx=HookContext(
|
|
393
|
+
config=self.sdk_configuration,
|
|
394
|
+
base_url=base_url or "",
|
|
395
|
+
operation_id="get_contractor",
|
|
396
|
+
oauth2_scopes=None,
|
|
397
|
+
security_source=get_security_from_env(
|
|
398
|
+
self.sdk_configuration.security, models.Security
|
|
399
|
+
),
|
|
400
|
+
),
|
|
401
|
+
request=req,
|
|
402
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
403
|
+
retry_config=retry_config,
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
response_data: Any = None
|
|
407
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
408
|
+
return unmarshal_json_response(models.ContractorProfile, http_res)
|
|
409
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
410
|
+
response_data = unmarshal_json_response(
|
|
411
|
+
errors.HTTPValidationErrorData, http_res
|
|
412
|
+
)
|
|
413
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
414
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
415
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
416
|
+
raise errors.PermitstackDefaultError(
|
|
417
|
+
"API error occurred", http_res, http_res_text
|
|
418
|
+
)
|
|
419
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
420
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
421
|
+
raise errors.PermitstackDefaultError(
|
|
422
|
+
"API error occurred", http_res, http_res_text
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
426
|
+
|
|
427
|
+
def get_contractor_permits(
|
|
428
|
+
self,
|
|
429
|
+
*,
|
|
430
|
+
contractor_id: str,
|
|
431
|
+
page: Optional[int] = 1,
|
|
432
|
+
per_page: Optional[int] = 25,
|
|
433
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
434
|
+
server_url: Optional[str] = None,
|
|
435
|
+
timeout_ms: Optional[int] = None,
|
|
436
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
437
|
+
) -> Any:
|
|
438
|
+
r"""Get Contractor Permits
|
|
439
|
+
|
|
440
|
+
Get all permits associated with a contractor.
|
|
441
|
+
|
|
442
|
+
:param contractor_id:
|
|
443
|
+
:param page:
|
|
444
|
+
:param per_page:
|
|
445
|
+
:param retries: Override the default retry configuration for this method
|
|
446
|
+
:param server_url: Override the default server URL for this method
|
|
447
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
448
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
449
|
+
"""
|
|
450
|
+
base_url = None
|
|
451
|
+
url_variables = None
|
|
452
|
+
if timeout_ms is None:
|
|
453
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
454
|
+
|
|
455
|
+
if server_url is not None:
|
|
456
|
+
base_url = server_url
|
|
457
|
+
else:
|
|
458
|
+
base_url = self._get_url(base_url, url_variables)
|
|
459
|
+
|
|
460
|
+
request = models.GetContractorPermitsRequest(
|
|
461
|
+
contractor_id=contractor_id,
|
|
462
|
+
page=page,
|
|
463
|
+
per_page=per_page,
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
req = self._build_request(
|
|
467
|
+
method="GET",
|
|
468
|
+
path="/v1/contractors/{contractor_id}/permits",
|
|
469
|
+
base_url=base_url,
|
|
470
|
+
url_variables=url_variables,
|
|
471
|
+
request=request,
|
|
472
|
+
request_body_required=False,
|
|
473
|
+
request_has_path_params=True,
|
|
474
|
+
request_has_query_params=True,
|
|
475
|
+
user_agent_header="user-agent",
|
|
476
|
+
accept_header_value="application/json",
|
|
477
|
+
http_headers=http_headers,
|
|
478
|
+
security=self.sdk_configuration.security,
|
|
479
|
+
allow_empty_value=None,
|
|
480
|
+
timeout_ms=timeout_ms,
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
if retries == UNSET:
|
|
484
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
485
|
+
retries = self.sdk_configuration.retry_config
|
|
486
|
+
|
|
487
|
+
retry_config = None
|
|
488
|
+
if isinstance(retries, utils.RetryConfig):
|
|
489
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
490
|
+
|
|
491
|
+
http_res = self.do_request(
|
|
492
|
+
hook_ctx=HookContext(
|
|
493
|
+
config=self.sdk_configuration,
|
|
494
|
+
base_url=base_url or "",
|
|
495
|
+
operation_id="get_contractor_permits",
|
|
496
|
+
oauth2_scopes=None,
|
|
497
|
+
security_source=get_security_from_env(
|
|
498
|
+
self.sdk_configuration.security, models.Security
|
|
499
|
+
),
|
|
500
|
+
),
|
|
501
|
+
request=req,
|
|
502
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
503
|
+
retry_config=retry_config,
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
response_data: Any = None
|
|
507
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
508
|
+
return unmarshal_json_response(Any, http_res)
|
|
509
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
510
|
+
response_data = unmarshal_json_response(
|
|
511
|
+
errors.HTTPValidationErrorData, http_res
|
|
512
|
+
)
|
|
513
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
514
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
515
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
516
|
+
raise errors.PermitstackDefaultError(
|
|
517
|
+
"API error occurred", http_res, http_res_text
|
|
518
|
+
)
|
|
519
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
520
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
521
|
+
raise errors.PermitstackDefaultError(
|
|
522
|
+
"API error occurred", http_res, http_res_text
|
|
523
|
+
)
|
|
524
|
+
|
|
525
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
526
|
+
|
|
527
|
+
async def get_contractor_permits_async(
|
|
528
|
+
self,
|
|
529
|
+
*,
|
|
530
|
+
contractor_id: str,
|
|
531
|
+
page: Optional[int] = 1,
|
|
532
|
+
per_page: Optional[int] = 25,
|
|
533
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
534
|
+
server_url: Optional[str] = None,
|
|
535
|
+
timeout_ms: Optional[int] = None,
|
|
536
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
537
|
+
) -> Any:
|
|
538
|
+
r"""Get Contractor Permits
|
|
539
|
+
|
|
540
|
+
Get all permits associated with a contractor.
|
|
541
|
+
|
|
542
|
+
:param contractor_id:
|
|
543
|
+
:param page:
|
|
544
|
+
:param per_page:
|
|
545
|
+
:param retries: Override the default retry configuration for this method
|
|
546
|
+
:param server_url: Override the default server URL for this method
|
|
547
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
548
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
549
|
+
"""
|
|
550
|
+
base_url = None
|
|
551
|
+
url_variables = None
|
|
552
|
+
if timeout_ms is None:
|
|
553
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
554
|
+
|
|
555
|
+
if server_url is not None:
|
|
556
|
+
base_url = server_url
|
|
557
|
+
else:
|
|
558
|
+
base_url = self._get_url(base_url, url_variables)
|
|
559
|
+
|
|
560
|
+
request = models.GetContractorPermitsRequest(
|
|
561
|
+
contractor_id=contractor_id,
|
|
562
|
+
page=page,
|
|
563
|
+
per_page=per_page,
|
|
564
|
+
)
|
|
565
|
+
|
|
566
|
+
req = self._build_request_async(
|
|
567
|
+
method="GET",
|
|
568
|
+
path="/v1/contractors/{contractor_id}/permits",
|
|
569
|
+
base_url=base_url,
|
|
570
|
+
url_variables=url_variables,
|
|
571
|
+
request=request,
|
|
572
|
+
request_body_required=False,
|
|
573
|
+
request_has_path_params=True,
|
|
574
|
+
request_has_query_params=True,
|
|
575
|
+
user_agent_header="user-agent",
|
|
576
|
+
accept_header_value="application/json",
|
|
577
|
+
http_headers=http_headers,
|
|
578
|
+
security=self.sdk_configuration.security,
|
|
579
|
+
allow_empty_value=None,
|
|
580
|
+
timeout_ms=timeout_ms,
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
if retries == UNSET:
|
|
584
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
585
|
+
retries = self.sdk_configuration.retry_config
|
|
586
|
+
|
|
587
|
+
retry_config = None
|
|
588
|
+
if isinstance(retries, utils.RetryConfig):
|
|
589
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
590
|
+
|
|
591
|
+
http_res = await self.do_request_async(
|
|
592
|
+
hook_ctx=HookContext(
|
|
593
|
+
config=self.sdk_configuration,
|
|
594
|
+
base_url=base_url or "",
|
|
595
|
+
operation_id="get_contractor_permits",
|
|
596
|
+
oauth2_scopes=None,
|
|
597
|
+
security_source=get_security_from_env(
|
|
598
|
+
self.sdk_configuration.security, models.Security
|
|
599
|
+
),
|
|
600
|
+
),
|
|
601
|
+
request=req,
|
|
602
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
603
|
+
retry_config=retry_config,
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
response_data: Any = None
|
|
607
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
608
|
+
return unmarshal_json_response(Any, http_res)
|
|
609
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
610
|
+
response_data = unmarshal_json_response(
|
|
611
|
+
errors.HTTPValidationErrorData, http_res
|
|
612
|
+
)
|
|
613
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
614
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
615
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
616
|
+
raise errors.PermitstackDefaultError(
|
|
617
|
+
"API error occurred", http_res, http_res_text
|
|
618
|
+
)
|
|
619
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
620
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
621
|
+
raise errors.PermitstackDefaultError(
|
|
622
|
+
"API error occurred", http_res, http_res_text
|
|
623
|
+
)
|
|
624
|
+
|
|
625
|
+
raise errors.PermitstackDefaultError("Unexpected response received", http_res)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .permitstackerror import PermitstackError
|
|
4
|
+
from typing import Any, TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from permitstack.utils.dynamic_imports import lazy_getattr, lazy_dir
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
|
|
10
|
+
from .no_response_error import NoResponseError
|
|
11
|
+
from .permitstackdefaulterror import PermitstackDefaultError
|
|
12
|
+
from .responsevalidationerror import ResponseValidationError
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"HTTPValidationError",
|
|
16
|
+
"HTTPValidationErrorData",
|
|
17
|
+
"NoResponseError",
|
|
18
|
+
"PermitstackDefaultError",
|
|
19
|
+
"PermitstackError",
|
|
20
|
+
"ResponseValidationError",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
_dynamic_imports: dict[str, str] = {
|
|
24
|
+
"HTTPValidationError": ".httpvalidationerror",
|
|
25
|
+
"HTTPValidationErrorData": ".httpvalidationerror",
|
|
26
|
+
"NoResponseError": ".no_response_error",
|
|
27
|
+
"PermitstackDefaultError": ".permitstackdefaulterror",
|
|
28
|
+
"ResponseValidationError": ".responsevalidationerror",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def __getattr__(attr_name: str) -> Any:
|
|
33
|
+
return lazy_getattr(
|
|
34
|
+
attr_name, package=__package__, dynamic_imports=_dynamic_imports
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def __dir__():
|
|
39
|
+
return lazy_dir(dynamic_imports=_dynamic_imports)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
import httpx
|
|
6
|
+
from permitstack.errors import PermitstackError
|
|
7
|
+
from permitstack.models import validationerror as models_validationerror
|
|
8
|
+
from permitstack.types import BaseModel
|
|
9
|
+
from typing import List, Optional
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class HTTPValidationErrorData(BaseModel):
|
|
13
|
+
detail: Optional[List[models_validationerror.ValidationError]] = None
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(unsafe_hash=True)
|
|
17
|
+
class HTTPValidationError(PermitstackError):
|
|
18
|
+
data: HTTPValidationErrorData = field(hash=False)
|
|
19
|
+
|
|
20
|
+
def __init__(
|
|
21
|
+
self,
|
|
22
|
+
data: HTTPValidationErrorData,
|
|
23
|
+
raw_response: httpx.Response,
|
|
24
|
+
body: Optional[str] = None,
|
|
25
|
+
):
|
|
26
|
+
message = body or raw_response.text
|
|
27
|
+
super().__init__(message, raw_response, body)
|
|
28
|
+
object.__setattr__(self, "data", data)
|