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,593 @@
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 Webhooks(BaseSDK):
13
+ r"""Subscribe to real-time permit events (paid tiers)"""
14
+
15
+ def list_webhooks(
16
+ self,
17
+ *,
18
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
19
+ server_url: Optional[str] = None,
20
+ timeout_ms: Optional[int] = None,
21
+ http_headers: Optional[Mapping[str, str]] = None,
22
+ ) -> Any:
23
+ r"""List Webhooks
24
+
25
+ List all your registered webhooks.
26
+
27
+ :param retries: Override the default retry configuration for this method
28
+ :param server_url: Override the default server URL for this method
29
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
30
+ :param http_headers: Additional headers to set or replace on requests.
31
+ """
32
+ base_url = None
33
+ url_variables = None
34
+ if timeout_ms is None:
35
+ timeout_ms = self.sdk_configuration.timeout_ms
36
+
37
+ if server_url is not None:
38
+ base_url = server_url
39
+ else:
40
+ base_url = self._get_url(base_url, url_variables)
41
+ req = self._build_request(
42
+ method="GET",
43
+ path="/v1/webhooks/",
44
+ base_url=base_url,
45
+ url_variables=url_variables,
46
+ request=None,
47
+ request_body_required=False,
48
+ request_has_path_params=False,
49
+ request_has_query_params=True,
50
+ user_agent_header="user-agent",
51
+ accept_header_value="application/json",
52
+ http_headers=http_headers,
53
+ security=self.sdk_configuration.security,
54
+ allow_empty_value=None,
55
+ timeout_ms=timeout_ms,
56
+ )
57
+
58
+ if retries == UNSET:
59
+ if self.sdk_configuration.retry_config is not UNSET:
60
+ retries = self.sdk_configuration.retry_config
61
+
62
+ retry_config = None
63
+ if isinstance(retries, utils.RetryConfig):
64
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
65
+
66
+ http_res = self.do_request(
67
+ hook_ctx=HookContext(
68
+ config=self.sdk_configuration,
69
+ base_url=base_url or "",
70
+ operation_id="list_webhooks",
71
+ oauth2_scopes=None,
72
+ security_source=get_security_from_env(
73
+ self.sdk_configuration.security, models.Security
74
+ ),
75
+ ),
76
+ request=req,
77
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
78
+ retry_config=retry_config,
79
+ )
80
+
81
+ if utils.match_response(http_res, "200", "application/json"):
82
+ return unmarshal_json_response(Any, http_res)
83
+ if utils.match_response(http_res, "4XX", "*"):
84
+ http_res_text = utils.stream_to_text(http_res)
85
+ raise errors.PermitstackDefaultError(
86
+ "API error occurred", http_res, http_res_text
87
+ )
88
+ if utils.match_response(http_res, "5XX", "*"):
89
+ http_res_text = utils.stream_to_text(http_res)
90
+ raise errors.PermitstackDefaultError(
91
+ "API error occurred", http_res, http_res_text
92
+ )
93
+
94
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)
95
+
96
+ async def list_webhooks_async(
97
+ self,
98
+ *,
99
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
100
+ server_url: Optional[str] = None,
101
+ timeout_ms: Optional[int] = None,
102
+ http_headers: Optional[Mapping[str, str]] = None,
103
+ ) -> Any:
104
+ r"""List Webhooks
105
+
106
+ List all your registered webhooks.
107
+
108
+ :param retries: Override the default retry configuration for this method
109
+ :param server_url: Override the default server URL for this method
110
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
111
+ :param http_headers: Additional headers to set or replace on requests.
112
+ """
113
+ base_url = None
114
+ url_variables = None
115
+ if timeout_ms is None:
116
+ timeout_ms = self.sdk_configuration.timeout_ms
117
+
118
+ if server_url is not None:
119
+ base_url = server_url
120
+ else:
121
+ base_url = self._get_url(base_url, url_variables)
122
+ req = self._build_request_async(
123
+ method="GET",
124
+ path="/v1/webhooks/",
125
+ base_url=base_url,
126
+ url_variables=url_variables,
127
+ request=None,
128
+ request_body_required=False,
129
+ request_has_path_params=False,
130
+ request_has_query_params=True,
131
+ user_agent_header="user-agent",
132
+ accept_header_value="application/json",
133
+ http_headers=http_headers,
134
+ security=self.sdk_configuration.security,
135
+ allow_empty_value=None,
136
+ timeout_ms=timeout_ms,
137
+ )
138
+
139
+ if retries == UNSET:
140
+ if self.sdk_configuration.retry_config is not UNSET:
141
+ retries = self.sdk_configuration.retry_config
142
+
143
+ retry_config = None
144
+ if isinstance(retries, utils.RetryConfig):
145
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
146
+
147
+ http_res = await self.do_request_async(
148
+ hook_ctx=HookContext(
149
+ config=self.sdk_configuration,
150
+ base_url=base_url or "",
151
+ operation_id="list_webhooks",
152
+ oauth2_scopes=None,
153
+ security_source=get_security_from_env(
154
+ self.sdk_configuration.security, models.Security
155
+ ),
156
+ ),
157
+ request=req,
158
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
159
+ retry_config=retry_config,
160
+ )
161
+
162
+ if utils.match_response(http_res, "200", "application/json"):
163
+ return unmarshal_json_response(Any, http_res)
164
+ if utils.match_response(http_res, "4XX", "*"):
165
+ http_res_text = await utils.stream_to_text_async(http_res)
166
+ raise errors.PermitstackDefaultError(
167
+ "API error occurred", http_res, http_res_text
168
+ )
169
+ if utils.match_response(http_res, "5XX", "*"):
170
+ http_res_text = await utils.stream_to_text_async(http_res)
171
+ raise errors.PermitstackDefaultError(
172
+ "API error occurred", http_res, http_res_text
173
+ )
174
+
175
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)
176
+
177
+ def create_webhook(
178
+ self,
179
+ *,
180
+ url: str,
181
+ city: OptionalNullable[str] = UNSET,
182
+ state: OptionalNullable[str] = UNSET,
183
+ category: OptionalNullable[str] = UNSET,
184
+ zip_code: OptionalNullable[str] = UNSET,
185
+ description: OptionalNullable[str] = UNSET,
186
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
187
+ server_url: Optional[str] = None,
188
+ timeout_ms: Optional[int] = None,
189
+ http_headers: Optional[Mapping[str, str]] = None,
190
+ ) -> Any:
191
+ r"""Create Webhook
192
+
193
+ Register a webhook to be notified when new permits match your filters.
194
+
195
+ Available on Starter ($49/mo) and above. Maximum 10 webhooks per API key.
196
+ When a new permit matches your filters, we'll POST the permit data as JSON to your URL.
197
+
198
+ :param url:
199
+ :param city:
200
+ :param state:
201
+ :param category:
202
+ :param zip_code:
203
+ :param description:
204
+ :param retries: Override the default retry configuration for this method
205
+ :param server_url: Override the default server URL for this method
206
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
207
+ :param http_headers: Additional headers to set or replace on requests.
208
+ """
209
+ base_url = None
210
+ url_variables = None
211
+ if timeout_ms is None:
212
+ timeout_ms = self.sdk_configuration.timeout_ms
213
+
214
+ if server_url is not None:
215
+ base_url = server_url
216
+ else:
217
+ base_url = self._get_url(base_url, url_variables)
218
+
219
+ request = models.WebhookCreate(
220
+ url=url,
221
+ city=city,
222
+ state=state,
223
+ category=category,
224
+ zip_code=zip_code,
225
+ description=description,
226
+ )
227
+
228
+ req = self._build_request(
229
+ method="POST",
230
+ path="/v1/webhooks/",
231
+ base_url=base_url,
232
+ url_variables=url_variables,
233
+ request=request,
234
+ request_body_required=True,
235
+ request_has_path_params=False,
236
+ request_has_query_params=True,
237
+ user_agent_header="user-agent",
238
+ accept_header_value="application/json",
239
+ http_headers=http_headers,
240
+ security=self.sdk_configuration.security,
241
+ get_serialized_body=lambda: utils.serialize_request_body(
242
+ request, False, False, "json", models.WebhookCreate
243
+ ),
244
+ allow_empty_value=None,
245
+ timeout_ms=timeout_ms,
246
+ )
247
+
248
+ if retries == UNSET:
249
+ if self.sdk_configuration.retry_config is not UNSET:
250
+ retries = self.sdk_configuration.retry_config
251
+
252
+ retry_config = None
253
+ if isinstance(retries, utils.RetryConfig):
254
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
255
+
256
+ http_res = self.do_request(
257
+ hook_ctx=HookContext(
258
+ config=self.sdk_configuration,
259
+ base_url=base_url or "",
260
+ operation_id="create_webhook",
261
+ oauth2_scopes=None,
262
+ security_source=get_security_from_env(
263
+ self.sdk_configuration.security, models.Security
264
+ ),
265
+ ),
266
+ request=req,
267
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
268
+ retry_config=retry_config,
269
+ )
270
+
271
+ response_data: Any = None
272
+ if utils.match_response(http_res, "200", "application/json"):
273
+ return unmarshal_json_response(Any, http_res)
274
+ if utils.match_response(http_res, "422", "application/json"):
275
+ response_data = unmarshal_json_response(
276
+ errors.HTTPValidationErrorData, http_res
277
+ )
278
+ raise errors.HTTPValidationError(response_data, http_res)
279
+ if utils.match_response(http_res, "4XX", "*"):
280
+ http_res_text = utils.stream_to_text(http_res)
281
+ raise errors.PermitstackDefaultError(
282
+ "API error occurred", http_res, http_res_text
283
+ )
284
+ if utils.match_response(http_res, "5XX", "*"):
285
+ http_res_text = utils.stream_to_text(http_res)
286
+ raise errors.PermitstackDefaultError(
287
+ "API error occurred", http_res, http_res_text
288
+ )
289
+
290
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)
291
+
292
+ async def create_webhook_async(
293
+ self,
294
+ *,
295
+ url: str,
296
+ city: OptionalNullable[str] = UNSET,
297
+ state: OptionalNullable[str] = UNSET,
298
+ category: OptionalNullable[str] = UNSET,
299
+ zip_code: OptionalNullable[str] = UNSET,
300
+ description: OptionalNullable[str] = UNSET,
301
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
302
+ server_url: Optional[str] = None,
303
+ timeout_ms: Optional[int] = None,
304
+ http_headers: Optional[Mapping[str, str]] = None,
305
+ ) -> Any:
306
+ r"""Create Webhook
307
+
308
+ Register a webhook to be notified when new permits match your filters.
309
+
310
+ Available on Starter ($49/mo) and above. Maximum 10 webhooks per API key.
311
+ When a new permit matches your filters, we'll POST the permit data as JSON to your URL.
312
+
313
+ :param url:
314
+ :param city:
315
+ :param state:
316
+ :param category:
317
+ :param zip_code:
318
+ :param description:
319
+ :param retries: Override the default retry configuration for this method
320
+ :param server_url: Override the default server URL for this method
321
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
322
+ :param http_headers: Additional headers to set or replace on requests.
323
+ """
324
+ base_url = None
325
+ url_variables = None
326
+ if timeout_ms is None:
327
+ timeout_ms = self.sdk_configuration.timeout_ms
328
+
329
+ if server_url is not None:
330
+ base_url = server_url
331
+ else:
332
+ base_url = self._get_url(base_url, url_variables)
333
+
334
+ request = models.WebhookCreate(
335
+ url=url,
336
+ city=city,
337
+ state=state,
338
+ category=category,
339
+ zip_code=zip_code,
340
+ description=description,
341
+ )
342
+
343
+ req = self._build_request_async(
344
+ method="POST",
345
+ path="/v1/webhooks/",
346
+ base_url=base_url,
347
+ url_variables=url_variables,
348
+ request=request,
349
+ request_body_required=True,
350
+ request_has_path_params=False,
351
+ request_has_query_params=True,
352
+ user_agent_header="user-agent",
353
+ accept_header_value="application/json",
354
+ http_headers=http_headers,
355
+ security=self.sdk_configuration.security,
356
+ get_serialized_body=lambda: utils.serialize_request_body(
357
+ request, False, False, "json", models.WebhookCreate
358
+ ),
359
+ allow_empty_value=None,
360
+ timeout_ms=timeout_ms,
361
+ )
362
+
363
+ if retries == UNSET:
364
+ if self.sdk_configuration.retry_config is not UNSET:
365
+ retries = self.sdk_configuration.retry_config
366
+
367
+ retry_config = None
368
+ if isinstance(retries, utils.RetryConfig):
369
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
370
+
371
+ http_res = await self.do_request_async(
372
+ hook_ctx=HookContext(
373
+ config=self.sdk_configuration,
374
+ base_url=base_url or "",
375
+ operation_id="create_webhook",
376
+ oauth2_scopes=None,
377
+ security_source=get_security_from_env(
378
+ self.sdk_configuration.security, models.Security
379
+ ),
380
+ ),
381
+ request=req,
382
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
383
+ retry_config=retry_config,
384
+ )
385
+
386
+ response_data: Any = None
387
+ if utils.match_response(http_res, "200", "application/json"):
388
+ return unmarshal_json_response(Any, http_res)
389
+ if utils.match_response(http_res, "422", "application/json"):
390
+ response_data = unmarshal_json_response(
391
+ errors.HTTPValidationErrorData, http_res
392
+ )
393
+ raise errors.HTTPValidationError(response_data, http_res)
394
+ if utils.match_response(http_res, "4XX", "*"):
395
+ http_res_text = await utils.stream_to_text_async(http_res)
396
+ raise errors.PermitstackDefaultError(
397
+ "API error occurred", http_res, http_res_text
398
+ )
399
+ if utils.match_response(http_res, "5XX", "*"):
400
+ http_res_text = await utils.stream_to_text_async(http_res)
401
+ raise errors.PermitstackDefaultError(
402
+ "API error occurred", http_res, http_res_text
403
+ )
404
+
405
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)
406
+
407
+ def delete_webhook(
408
+ self,
409
+ *,
410
+ webhook_id: str,
411
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
412
+ server_url: Optional[str] = None,
413
+ timeout_ms: Optional[int] = None,
414
+ http_headers: Optional[Mapping[str, str]] = None,
415
+ ) -> Any:
416
+ r"""Delete Webhook
417
+
418
+ Delete a webhook.
419
+
420
+ :param webhook_id:
421
+ :param retries: Override the default retry configuration for this method
422
+ :param server_url: Override the default server URL for this method
423
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
424
+ :param http_headers: Additional headers to set or replace on requests.
425
+ """
426
+ base_url = None
427
+ url_variables = None
428
+ if timeout_ms is None:
429
+ timeout_ms = self.sdk_configuration.timeout_ms
430
+
431
+ if server_url is not None:
432
+ base_url = server_url
433
+ else:
434
+ base_url = self._get_url(base_url, url_variables)
435
+
436
+ request = models.DeleteWebhookRequest(
437
+ webhook_id=webhook_id,
438
+ )
439
+
440
+ req = self._build_request(
441
+ method="DELETE",
442
+ path="/v1/webhooks/{webhook_id}",
443
+ base_url=base_url,
444
+ url_variables=url_variables,
445
+ request=request,
446
+ request_body_required=False,
447
+ request_has_path_params=True,
448
+ request_has_query_params=True,
449
+ user_agent_header="user-agent",
450
+ accept_header_value="application/json",
451
+ http_headers=http_headers,
452
+ security=self.sdk_configuration.security,
453
+ allow_empty_value=None,
454
+ timeout_ms=timeout_ms,
455
+ )
456
+
457
+ if retries == UNSET:
458
+ if self.sdk_configuration.retry_config is not UNSET:
459
+ retries = self.sdk_configuration.retry_config
460
+
461
+ retry_config = None
462
+ if isinstance(retries, utils.RetryConfig):
463
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
464
+
465
+ http_res = self.do_request(
466
+ hook_ctx=HookContext(
467
+ config=self.sdk_configuration,
468
+ base_url=base_url or "",
469
+ operation_id="delete_webhook",
470
+ oauth2_scopes=None,
471
+ security_source=get_security_from_env(
472
+ self.sdk_configuration.security, models.Security
473
+ ),
474
+ ),
475
+ request=req,
476
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
477
+ retry_config=retry_config,
478
+ )
479
+
480
+ response_data: Any = None
481
+ if utils.match_response(http_res, "200", "application/json"):
482
+ return unmarshal_json_response(Any, http_res)
483
+ if utils.match_response(http_res, "422", "application/json"):
484
+ response_data = unmarshal_json_response(
485
+ errors.HTTPValidationErrorData, http_res
486
+ )
487
+ raise errors.HTTPValidationError(response_data, http_res)
488
+ if utils.match_response(http_res, "4XX", "*"):
489
+ http_res_text = utils.stream_to_text(http_res)
490
+ raise errors.PermitstackDefaultError(
491
+ "API error occurred", http_res, http_res_text
492
+ )
493
+ if utils.match_response(http_res, "5XX", "*"):
494
+ http_res_text = utils.stream_to_text(http_res)
495
+ raise errors.PermitstackDefaultError(
496
+ "API error occurred", http_res, http_res_text
497
+ )
498
+
499
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)
500
+
501
+ async def delete_webhook_async(
502
+ self,
503
+ *,
504
+ webhook_id: str,
505
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
506
+ server_url: Optional[str] = None,
507
+ timeout_ms: Optional[int] = None,
508
+ http_headers: Optional[Mapping[str, str]] = None,
509
+ ) -> Any:
510
+ r"""Delete Webhook
511
+
512
+ Delete a webhook.
513
+
514
+ :param webhook_id:
515
+ :param retries: Override the default retry configuration for this method
516
+ :param server_url: Override the default server URL for this method
517
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
518
+ :param http_headers: Additional headers to set or replace on requests.
519
+ """
520
+ base_url = None
521
+ url_variables = None
522
+ if timeout_ms is None:
523
+ timeout_ms = self.sdk_configuration.timeout_ms
524
+
525
+ if server_url is not None:
526
+ base_url = server_url
527
+ else:
528
+ base_url = self._get_url(base_url, url_variables)
529
+
530
+ request = models.DeleteWebhookRequest(
531
+ webhook_id=webhook_id,
532
+ )
533
+
534
+ req = self._build_request_async(
535
+ method="DELETE",
536
+ path="/v1/webhooks/{webhook_id}",
537
+ base_url=base_url,
538
+ url_variables=url_variables,
539
+ request=request,
540
+ request_body_required=False,
541
+ request_has_path_params=True,
542
+ request_has_query_params=True,
543
+ user_agent_header="user-agent",
544
+ accept_header_value="application/json",
545
+ http_headers=http_headers,
546
+ security=self.sdk_configuration.security,
547
+ allow_empty_value=None,
548
+ timeout_ms=timeout_ms,
549
+ )
550
+
551
+ if retries == UNSET:
552
+ if self.sdk_configuration.retry_config is not UNSET:
553
+ retries = self.sdk_configuration.retry_config
554
+
555
+ retry_config = None
556
+ if isinstance(retries, utils.RetryConfig):
557
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
558
+
559
+ http_res = await self.do_request_async(
560
+ hook_ctx=HookContext(
561
+ config=self.sdk_configuration,
562
+ base_url=base_url or "",
563
+ operation_id="delete_webhook",
564
+ oauth2_scopes=None,
565
+ security_source=get_security_from_env(
566
+ self.sdk_configuration.security, models.Security
567
+ ),
568
+ ),
569
+ request=req,
570
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
571
+ retry_config=retry_config,
572
+ )
573
+
574
+ response_data: Any = None
575
+ if utils.match_response(http_res, "200", "application/json"):
576
+ return unmarshal_json_response(Any, http_res)
577
+ if utils.match_response(http_res, "422", "application/json"):
578
+ response_data = unmarshal_json_response(
579
+ errors.HTTPValidationErrorData, http_res
580
+ )
581
+ raise errors.HTTPValidationError(response_data, http_res)
582
+ if utils.match_response(http_res, "4XX", "*"):
583
+ http_res_text = await utils.stream_to_text_async(http_res)
584
+ raise errors.PermitstackDefaultError(
585
+ "API error occurred", http_res, http_res_text
586
+ )
587
+ if utils.match_response(http_res, "5XX", "*"):
588
+ http_res_text = await utils.stream_to_text_async(http_res)
589
+ raise errors.PermitstackDefaultError(
590
+ "API error occurred", http_res, http_res_text
591
+ )
592
+
593
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)