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,17 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from dataclasses import dataclass
4
+
5
+
6
+ @dataclass(unsafe_hash=True)
7
+ class NoResponseError(Exception):
8
+ """Error raised when no HTTP response is received from the server."""
9
+
10
+ message: str
11
+
12
+ def __init__(self, message: str = "No response received"):
13
+ object.__setattr__(self, "message", message)
14
+ super().__init__(message)
15
+
16
+ def __str__(self):
17
+ return self.message
@@ -0,0 +1,40 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import httpx
4
+ from typing import Optional
5
+ from dataclasses import dataclass
6
+
7
+ from permitstack.errors import PermitstackError
8
+
9
+ MAX_MESSAGE_LEN = 10_000
10
+
11
+
12
+ @dataclass(unsafe_hash=True)
13
+ class PermitstackDefaultError(PermitstackError):
14
+ """The fallback error class if no more specific error class is matched."""
15
+
16
+ def __init__(
17
+ self, message: str, raw_response: httpx.Response, body: Optional[str] = None
18
+ ):
19
+ body_display = body or raw_response.text or '""'
20
+
21
+ if message:
22
+ message += ": "
23
+ message += f"Status {raw_response.status_code}"
24
+
25
+ headers = raw_response.headers
26
+ content_type = headers.get("content-type", '""')
27
+ if content_type != "application/json":
28
+ if " " in content_type:
29
+ content_type = f'"{content_type}"'
30
+ message += f" Content-Type {content_type}"
31
+
32
+ if len(body_display) > MAX_MESSAGE_LEN:
33
+ truncated = body_display[:MAX_MESSAGE_LEN]
34
+ remaining = len(body_display) - MAX_MESSAGE_LEN
35
+ body_display = f"{truncated}...and {remaining} more chars"
36
+
37
+ message += f". Body: {body_display}"
38
+ message = message.strip()
39
+
40
+ super().__init__(message, raw_response, body)
@@ -0,0 +1,30 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import httpx
4
+ from typing import Optional
5
+ from dataclasses import dataclass, field
6
+
7
+
8
+ @dataclass(unsafe_hash=True)
9
+ class PermitstackError(Exception):
10
+ """The base class for all HTTP error responses."""
11
+
12
+ message: str
13
+ status_code: int
14
+ body: str
15
+ headers: httpx.Headers = field(hash=False)
16
+ raw_response: httpx.Response = field(hash=False)
17
+
18
+ def __init__(
19
+ self, message: str, raw_response: httpx.Response, body: Optional[str] = None
20
+ ):
21
+ object.__setattr__(self, "message", message)
22
+ object.__setattr__(self, "status_code", raw_response.status_code)
23
+ object.__setattr__(
24
+ self, "body", body if body is not None else raw_response.text
25
+ )
26
+ object.__setattr__(self, "headers", raw_response.headers)
27
+ object.__setattr__(self, "raw_response", raw_response)
28
+
29
+ def __str__(self):
30
+ return self.message
@@ -0,0 +1,27 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import httpx
4
+ from typing import Optional
5
+ from dataclasses import dataclass
6
+
7
+ from permitstack.errors import PermitstackError
8
+
9
+
10
+ @dataclass(unsafe_hash=True)
11
+ class ResponseValidationError(PermitstackError):
12
+ """Error raised when there is a type mismatch between the response data and the expected Pydantic model."""
13
+
14
+ def __init__(
15
+ self,
16
+ message: str,
17
+ raw_response: httpx.Response,
18
+ cause: Exception,
19
+ body: Optional[str] = None,
20
+ ):
21
+ message = f"{message}: {cause}"
22
+ super().__init__(message, raw_response, body)
23
+
24
+ @property
25
+ def cause(self):
26
+ """Normally the Pydantic ValidationError"""
27
+ return self.__cause__
permitstack/health.py ADDED
@@ -0,0 +1,171 @@
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 Health(BaseSDK):
13
+ r"""Service health checks"""
14
+
15
+ def health_check(
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"""Health Check
24
+
25
+ :param retries: Override the default retry configuration for this method
26
+ :param server_url: Override the default server URL for this method
27
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
28
+ :param http_headers: Additional headers to set or replace on requests.
29
+ """
30
+ base_url = None
31
+ url_variables = None
32
+ if timeout_ms is None:
33
+ timeout_ms = self.sdk_configuration.timeout_ms
34
+
35
+ if server_url is not None:
36
+ base_url = server_url
37
+ else:
38
+ base_url = self._get_url(base_url, url_variables)
39
+ req = self._build_request(
40
+ method="GET",
41
+ path="/health",
42
+ base_url=base_url,
43
+ url_variables=url_variables,
44
+ request=None,
45
+ request_body_required=False,
46
+ request_has_path_params=False,
47
+ request_has_query_params=True,
48
+ user_agent_header="user-agent",
49
+ accept_header_value="application/json",
50
+ http_headers=http_headers,
51
+ security=self.sdk_configuration.security,
52
+ allow_empty_value=None,
53
+ timeout_ms=timeout_ms,
54
+ )
55
+
56
+ if retries == UNSET:
57
+ if self.sdk_configuration.retry_config is not UNSET:
58
+ retries = self.sdk_configuration.retry_config
59
+
60
+ retry_config = None
61
+ if isinstance(retries, utils.RetryConfig):
62
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
63
+
64
+ http_res = self.do_request(
65
+ hook_ctx=HookContext(
66
+ config=self.sdk_configuration,
67
+ base_url=base_url or "",
68
+ operation_id="health_check",
69
+ oauth2_scopes=None,
70
+ security_source=get_security_from_env(
71
+ self.sdk_configuration.security, models.Security
72
+ ),
73
+ ),
74
+ request=req,
75
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
76
+ retry_config=retry_config,
77
+ )
78
+
79
+ if utils.match_response(http_res, "200", "application/json"):
80
+ return unmarshal_json_response(Any, http_res)
81
+ if utils.match_response(http_res, "4XX", "*"):
82
+ http_res_text = utils.stream_to_text(http_res)
83
+ raise errors.PermitstackDefaultError(
84
+ "API error occurred", http_res, http_res_text
85
+ )
86
+ if utils.match_response(http_res, "5XX", "*"):
87
+ http_res_text = utils.stream_to_text(http_res)
88
+ raise errors.PermitstackDefaultError(
89
+ "API error occurred", http_res, http_res_text
90
+ )
91
+
92
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)
93
+
94
+ async def health_check_async(
95
+ self,
96
+ *,
97
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
98
+ server_url: Optional[str] = None,
99
+ timeout_ms: Optional[int] = None,
100
+ http_headers: Optional[Mapping[str, str]] = None,
101
+ ) -> Any:
102
+ r"""Health Check
103
+
104
+ :param retries: Override the default retry configuration for this method
105
+ :param server_url: Override the default server URL for this method
106
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
107
+ :param http_headers: Additional headers to set or replace on requests.
108
+ """
109
+ base_url = None
110
+ url_variables = None
111
+ if timeout_ms is None:
112
+ timeout_ms = self.sdk_configuration.timeout_ms
113
+
114
+ if server_url is not None:
115
+ base_url = server_url
116
+ else:
117
+ base_url = self._get_url(base_url, url_variables)
118
+ req = self._build_request_async(
119
+ method="GET",
120
+ path="/health",
121
+ base_url=base_url,
122
+ url_variables=url_variables,
123
+ request=None,
124
+ request_body_required=False,
125
+ request_has_path_params=False,
126
+ request_has_query_params=True,
127
+ user_agent_header="user-agent",
128
+ accept_header_value="application/json",
129
+ http_headers=http_headers,
130
+ security=self.sdk_configuration.security,
131
+ allow_empty_value=None,
132
+ timeout_ms=timeout_ms,
133
+ )
134
+
135
+ if retries == UNSET:
136
+ if self.sdk_configuration.retry_config is not UNSET:
137
+ retries = self.sdk_configuration.retry_config
138
+
139
+ retry_config = None
140
+ if isinstance(retries, utils.RetryConfig):
141
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
142
+
143
+ http_res = await self.do_request_async(
144
+ hook_ctx=HookContext(
145
+ config=self.sdk_configuration,
146
+ base_url=base_url or "",
147
+ operation_id="health_check",
148
+ oauth2_scopes=None,
149
+ security_source=get_security_from_env(
150
+ self.sdk_configuration.security, models.Security
151
+ ),
152
+ ),
153
+ request=req,
154
+ is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
155
+ retry_config=retry_config,
156
+ )
157
+
158
+ if utils.match_response(http_res, "200", "application/json"):
159
+ return unmarshal_json_response(Any, http_res)
160
+ if utils.match_response(http_res, "4XX", "*"):
161
+ http_res_text = await utils.stream_to_text_async(http_res)
162
+ raise errors.PermitstackDefaultError(
163
+ "API error occurred", http_res, http_res_text
164
+ )
165
+ if utils.match_response(http_res, "5XX", "*"):
166
+ http_res_text = await utils.stream_to_text_async(http_res)
167
+ raise errors.PermitstackDefaultError(
168
+ "API error occurred", http_res, http_res_text
169
+ )
170
+
171
+ raise errors.PermitstackDefaultError("Unexpected response received", http_res)
@@ -0,0 +1,125 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ # pyright: reportReturnType = false
4
+ import asyncio
5
+ from typing_extensions import Protocol, runtime_checkable
6
+ import httpx
7
+ from typing import Any, Optional, Union
8
+
9
+
10
+ @runtime_checkable
11
+ class HttpClient(Protocol):
12
+ def send(
13
+ self,
14
+ request: httpx.Request,
15
+ *,
16
+ stream: bool = False,
17
+ auth: Union[
18
+ httpx._types.AuthTypes, httpx._client.UseClientDefault, None
19
+ ] = httpx.USE_CLIENT_DEFAULT,
20
+ follow_redirects: Union[
21
+ bool, httpx._client.UseClientDefault
22
+ ] = httpx.USE_CLIENT_DEFAULT,
23
+ ) -> httpx.Response:
24
+ pass
25
+
26
+ def build_request(
27
+ self,
28
+ method: str,
29
+ url: httpx._types.URLTypes,
30
+ *,
31
+ content: Optional[httpx._types.RequestContent] = None,
32
+ data: Optional[httpx._types.RequestData] = None,
33
+ files: Optional[httpx._types.RequestFiles] = None,
34
+ json: Optional[Any] = None,
35
+ params: Optional[httpx._types.QueryParamTypes] = None,
36
+ headers: Optional[httpx._types.HeaderTypes] = None,
37
+ cookies: Optional[httpx._types.CookieTypes] = None,
38
+ timeout: Union[
39
+ httpx._types.TimeoutTypes, httpx._client.UseClientDefault
40
+ ] = httpx.USE_CLIENT_DEFAULT,
41
+ extensions: Optional[httpx._types.RequestExtensions] = None,
42
+ ) -> httpx.Request:
43
+ pass
44
+
45
+ def close(self) -> None:
46
+ pass
47
+
48
+
49
+ @runtime_checkable
50
+ class AsyncHttpClient(Protocol):
51
+ async def send(
52
+ self,
53
+ request: httpx.Request,
54
+ *,
55
+ stream: bool = False,
56
+ auth: Union[
57
+ httpx._types.AuthTypes, httpx._client.UseClientDefault, None
58
+ ] = httpx.USE_CLIENT_DEFAULT,
59
+ follow_redirects: Union[
60
+ bool, httpx._client.UseClientDefault
61
+ ] = httpx.USE_CLIENT_DEFAULT,
62
+ ) -> httpx.Response:
63
+ pass
64
+
65
+ def build_request(
66
+ self,
67
+ method: str,
68
+ url: httpx._types.URLTypes,
69
+ *,
70
+ content: Optional[httpx._types.RequestContent] = None,
71
+ data: Optional[httpx._types.RequestData] = None,
72
+ files: Optional[httpx._types.RequestFiles] = None,
73
+ json: Optional[Any] = None,
74
+ params: Optional[httpx._types.QueryParamTypes] = None,
75
+ headers: Optional[httpx._types.HeaderTypes] = None,
76
+ cookies: Optional[httpx._types.CookieTypes] = None,
77
+ timeout: Union[
78
+ httpx._types.TimeoutTypes, httpx._client.UseClientDefault
79
+ ] = httpx.USE_CLIENT_DEFAULT,
80
+ extensions: Optional[httpx._types.RequestExtensions] = None,
81
+ ) -> httpx.Request:
82
+ pass
83
+
84
+ async def aclose(self) -> None:
85
+ pass
86
+
87
+
88
+ class ClientOwner(Protocol):
89
+ client: Union[HttpClient, None]
90
+ async_client: Union[AsyncHttpClient, None]
91
+
92
+
93
+ def close_clients(
94
+ owner: ClientOwner,
95
+ sync_client: Union[HttpClient, None],
96
+ sync_client_supplied: bool,
97
+ async_client: Union[AsyncHttpClient, None],
98
+ async_client_supplied: bool,
99
+ ) -> None:
100
+ """
101
+ A finalizer function that is meant to be used with weakref.finalize to close
102
+ httpx clients used by an SDK so that underlying resources can be garbage
103
+ collected.
104
+ """
105
+
106
+ # Unset the client/async_client properties so there are no more references
107
+ # to them from the owning SDK instance and they can be reaped.
108
+ owner.client = None
109
+ owner.async_client = None
110
+ if sync_client is not None and not sync_client_supplied:
111
+ try:
112
+ sync_client.close()
113
+ except Exception:
114
+ pass
115
+
116
+ if async_client is not None and not async_client_supplied:
117
+ try:
118
+ loop = asyncio.get_running_loop()
119
+ asyncio.run_coroutine_threadsafe(async_client.aclose(), loop)
120
+ except RuntimeError:
121
+ try:
122
+ asyncio.run(async_client.aclose())
123
+ except RuntimeError:
124
+ # best effort
125
+ pass
@@ -0,0 +1,158 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from typing import Any, TYPE_CHECKING
4
+
5
+ from permitstack.utils.dynamic_imports import lazy_getattr, lazy_dir
6
+
7
+ if TYPE_CHECKING:
8
+ from .contractorprofile import ContractorProfile, ContractorProfileTypedDict
9
+ from .contractorsearchresponse import (
10
+ ContractorSearchResponse,
11
+ ContractorSearchResponseTypedDict,
12
+ )
13
+ from .contractorsummary import ContractorSummary, ContractorSummaryTypedDict
14
+ from .delete_webhookop import DeleteWebhookRequest, DeleteWebhookRequestTypedDict
15
+ from .export_permits_csvop import (
16
+ ExportPermitsCsvRequest,
17
+ ExportPermitsCsvRequestTypedDict,
18
+ )
19
+ from .get_contractor_permitsop import (
20
+ GetContractorPermitsRequest,
21
+ GetContractorPermitsRequestTypedDict,
22
+ )
23
+ from .get_contractorop import GetContractorRequest, GetContractorRequestTypedDict
24
+ from .get_permitop import GetPermitRequest, GetPermitRequestTypedDict
25
+ from .get_permits_by_addressop import (
26
+ GetPermitsByAddressRequest,
27
+ GetPermitsByAddressRequestTypedDict,
28
+ )
29
+ from .get_property_historyop import (
30
+ GetPropertyHistoryRequest,
31
+ GetPropertyHistoryRequestTypedDict,
32
+ )
33
+ from .permitcategory import PermitCategory
34
+ from .permitdetail import PermitDetail, PermitDetailTypedDict
35
+ from .permitsearchresponse import (
36
+ PermitSearchResponse,
37
+ PermitSearchResponseTypedDict,
38
+ )
39
+ from .permitstatus import PermitStatus
40
+ from .permitsummary import PermitSummary, PermitSummaryTypedDict
41
+ from .propertytype import PropertyType
42
+ from .search_contractorsop import (
43
+ SearchContractorsRequest,
44
+ SearchContractorsRequestTypedDict,
45
+ )
46
+ from .search_permitsop import SearchPermitsRequest, SearchPermitsRequestTypedDict
47
+ from .security import Security, SecurityTypedDict
48
+ from .validationerror import (
49
+ Context,
50
+ ContextTypedDict,
51
+ Loc,
52
+ LocTypedDict,
53
+ ValidationError,
54
+ ValidationErrorTypedDict,
55
+ )
56
+ from .webhookcreate import WebhookCreate, WebhookCreateTypedDict
57
+
58
+ __all__ = [
59
+ "Context",
60
+ "ContextTypedDict",
61
+ "ContractorProfile",
62
+ "ContractorProfileTypedDict",
63
+ "ContractorSearchResponse",
64
+ "ContractorSearchResponseTypedDict",
65
+ "ContractorSummary",
66
+ "ContractorSummaryTypedDict",
67
+ "DeleteWebhookRequest",
68
+ "DeleteWebhookRequestTypedDict",
69
+ "ExportPermitsCsvRequest",
70
+ "ExportPermitsCsvRequestTypedDict",
71
+ "GetContractorPermitsRequest",
72
+ "GetContractorPermitsRequestTypedDict",
73
+ "GetContractorRequest",
74
+ "GetContractorRequestTypedDict",
75
+ "GetPermitRequest",
76
+ "GetPermitRequestTypedDict",
77
+ "GetPermitsByAddressRequest",
78
+ "GetPermitsByAddressRequestTypedDict",
79
+ "GetPropertyHistoryRequest",
80
+ "GetPropertyHistoryRequestTypedDict",
81
+ "Loc",
82
+ "LocTypedDict",
83
+ "PermitCategory",
84
+ "PermitDetail",
85
+ "PermitDetailTypedDict",
86
+ "PermitSearchResponse",
87
+ "PermitSearchResponseTypedDict",
88
+ "PermitStatus",
89
+ "PermitSummary",
90
+ "PermitSummaryTypedDict",
91
+ "PropertyType",
92
+ "SearchContractorsRequest",
93
+ "SearchContractorsRequestTypedDict",
94
+ "SearchPermitsRequest",
95
+ "SearchPermitsRequestTypedDict",
96
+ "Security",
97
+ "SecurityTypedDict",
98
+ "ValidationError",
99
+ "ValidationErrorTypedDict",
100
+ "WebhookCreate",
101
+ "WebhookCreateTypedDict",
102
+ ]
103
+
104
+ _dynamic_imports: dict[str, str] = {
105
+ "ContractorProfile": ".contractorprofile",
106
+ "ContractorProfileTypedDict": ".contractorprofile",
107
+ "ContractorSearchResponse": ".contractorsearchresponse",
108
+ "ContractorSearchResponseTypedDict": ".contractorsearchresponse",
109
+ "ContractorSummary": ".contractorsummary",
110
+ "ContractorSummaryTypedDict": ".contractorsummary",
111
+ "DeleteWebhookRequest": ".delete_webhookop",
112
+ "DeleteWebhookRequestTypedDict": ".delete_webhookop",
113
+ "ExportPermitsCsvRequest": ".export_permits_csvop",
114
+ "ExportPermitsCsvRequestTypedDict": ".export_permits_csvop",
115
+ "GetContractorPermitsRequest": ".get_contractor_permitsop",
116
+ "GetContractorPermitsRequestTypedDict": ".get_contractor_permitsop",
117
+ "GetContractorRequest": ".get_contractorop",
118
+ "GetContractorRequestTypedDict": ".get_contractorop",
119
+ "GetPermitRequest": ".get_permitop",
120
+ "GetPermitRequestTypedDict": ".get_permitop",
121
+ "GetPermitsByAddressRequest": ".get_permits_by_addressop",
122
+ "GetPermitsByAddressRequestTypedDict": ".get_permits_by_addressop",
123
+ "GetPropertyHistoryRequest": ".get_property_historyop",
124
+ "GetPropertyHistoryRequestTypedDict": ".get_property_historyop",
125
+ "PermitCategory": ".permitcategory",
126
+ "PermitDetail": ".permitdetail",
127
+ "PermitDetailTypedDict": ".permitdetail",
128
+ "PermitSearchResponse": ".permitsearchresponse",
129
+ "PermitSearchResponseTypedDict": ".permitsearchresponse",
130
+ "PermitStatus": ".permitstatus",
131
+ "PermitSummary": ".permitsummary",
132
+ "PermitSummaryTypedDict": ".permitsummary",
133
+ "PropertyType": ".propertytype",
134
+ "SearchContractorsRequest": ".search_contractorsop",
135
+ "SearchContractorsRequestTypedDict": ".search_contractorsop",
136
+ "SearchPermitsRequest": ".search_permitsop",
137
+ "SearchPermitsRequestTypedDict": ".search_permitsop",
138
+ "Security": ".security",
139
+ "SecurityTypedDict": ".security",
140
+ "Context": ".validationerror",
141
+ "ContextTypedDict": ".validationerror",
142
+ "Loc": ".validationerror",
143
+ "LocTypedDict": ".validationerror",
144
+ "ValidationError": ".validationerror",
145
+ "ValidationErrorTypedDict": ".validationerror",
146
+ "WebhookCreate": ".webhookcreate",
147
+ "WebhookCreateTypedDict": ".webhookcreate",
148
+ }
149
+
150
+
151
+ def __getattr__(attr_name: str) -> Any:
152
+ return lazy_getattr(
153
+ attr_name, package=__package__, dynamic_imports=_dynamic_imports
154
+ )
155
+
156
+
157
+ def __dir__():
158
+ return lazy_dir(dynamic_imports=_dynamic_imports)
@@ -0,0 +1,108 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from datetime import date
5
+ from permitstack.types import (
6
+ BaseModel,
7
+ Nullable,
8
+ OptionalNullable,
9
+ UNSET,
10
+ UNSET_SENTINEL,
11
+ )
12
+ from pydantic import model_serializer
13
+ from typing import List
14
+ from typing_extensions import NotRequired, TypedDict
15
+
16
+
17
+ class ContractorProfileTypedDict(TypedDict):
18
+ id: str
19
+ name: str
20
+ license_number: Nullable[str]
21
+ license_state: Nullable[str]
22
+ city: Nullable[str]
23
+ state: Nullable[str]
24
+ total_permits: int
25
+ first_permit_date: Nullable[date]
26
+ last_permit_date: Nullable[date]
27
+ specialties: Nullable[List[str]]
28
+ phone: Nullable[str]
29
+ email: Nullable[str]
30
+ address: Nullable[str]
31
+ zip_code: Nullable[str]
32
+ recent_categories: NotRequired[Nullable[List[str]]]
33
+ avg_project_value: NotRequired[Nullable[float]]
34
+
35
+
36
+ class ContractorProfile(BaseModel):
37
+ id: str
38
+
39
+ name: str
40
+
41
+ license_number: Nullable[str]
42
+
43
+ license_state: Nullable[str]
44
+
45
+ city: Nullable[str]
46
+
47
+ state: Nullable[str]
48
+
49
+ total_permits: int
50
+
51
+ first_permit_date: Nullable[date]
52
+
53
+ last_permit_date: Nullable[date]
54
+
55
+ specialties: Nullable[List[str]]
56
+
57
+ phone: Nullable[str]
58
+
59
+ email: Nullable[str]
60
+
61
+ address: Nullable[str]
62
+
63
+ zip_code: Nullable[str]
64
+
65
+ recent_categories: OptionalNullable[List[str]] = UNSET
66
+
67
+ avg_project_value: OptionalNullable[float] = UNSET
68
+
69
+ @model_serializer(mode="wrap")
70
+ def serialize_model(self, handler):
71
+ optional_fields = set(["recent_categories", "avg_project_value"])
72
+ nullable_fields = set(
73
+ [
74
+ "license_number",
75
+ "license_state",
76
+ "city",
77
+ "state",
78
+ "first_permit_date",
79
+ "last_permit_date",
80
+ "specialties",
81
+ "phone",
82
+ "email",
83
+ "address",
84
+ "zip_code",
85
+ "recent_categories",
86
+ "avg_project_value",
87
+ ]
88
+ )
89
+ serialized = handler(self)
90
+ m = {}
91
+
92
+ for n, f in type(self).model_fields.items():
93
+ k = f.alias or n
94
+ val = serialized.get(k, serialized.get(n))
95
+ is_nullable_and_explicitly_set = (
96
+ k in nullable_fields
97
+ and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member
98
+ )
99
+
100
+ if val != UNSET_SENTINEL:
101
+ if (
102
+ val is not None
103
+ or k not in optional_fields
104
+ or is_nullable_and_explicitly_set
105
+ ):
106
+ m[k] = val
107
+
108
+ return m