daknode 0.1.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.
- daknode/__init__.py +8 -0
- daknode/api/__init__.py +1 -0
- daknode/api/block_rules/__init__.py +1 -0
- daknode/api/block_rules/create_block_rule.py +211 -0
- daknode/api/block_rules/create_inbox_block_rule.py +225 -0
- daknode/api/block_rules/delete_block_rule.py +192 -0
- daknode/api/block_rules/list_block_rules.py +214 -0
- daknode/api/block_rules/list_inbox_block_rules.py +228 -0
- daknode/api/consent/__init__.py +1 -0
- daknode/api/consent/create_consent.py +203 -0
- daknode/api/consent/revoke.py +195 -0
- daknode/api/control_plane/__init__.py +1 -0
- daknode/api/control_plane/close_workspace.py +184 -0
- daknode/api/control_plane/create_workspace.py +211 -0
- daknode/api/control_plane/list_workspaces.py +155 -0
- daknode/api/control_plane/read_workspace.py +176 -0
- daknode/api/control_plane/update_workspace.py +197 -0
- daknode/api/dead_letters/__init__.py +1 -0
- daknode/api/dead_letters/list_dead_letters.py +198 -0
- daknode/api/dead_letters/replay_dead_letter.py +216 -0
- daknode/api/inboxes/__init__.py +1 -0
- daknode/api/inboxes/create_inbox.py +183 -0
- daknode/api/inboxes/register_webhook.py +225 -0
- daknode/api/inboxes/rotate_webhook_secret.py +224 -0
- daknode/api/messages/__init__.py +1 -0
- daknode/api/messages/get_message.py +176 -0
- daknode/api/messages/get_thread.py +184 -0
- daknode/api/messages/list_messages.py +228 -0
- daknode/api/messages/list_threads.py +228 -0
- daknode/api/privacy/__init__.py +1 -0
- daknode/api/privacy/create_erasure_request.py +227 -0
- daknode/api/privacy/read_erasure_request.py +200 -0
- daknode/api/public/__init__.py +1 -0
- daknode/api/public/agent_signup.py +191 -0
- daknode/api/public/agent_verify.py +191 -0
- daknode/api/search/__init__.py +1 -0
- daknode/api/search/search.py +207 -0
- daknode/api/send/__init__.py +1 -0
- daknode/api/send/send.py +254 -0
- daknode/client.py +270 -0
- daknode/errors.py +14 -0
- daknode/models/__init__.py +79 -0
- daknode/models/block_rule_create.py +104 -0
- daknode/models/block_rule_out.py +160 -0
- daknode/models/block_rule_page.py +116 -0
- daknode/models/consent_request.py +104 -0
- daknode/models/consent_response.py +105 -0
- daknode/models/create_erasure_request_response_create_erasure_request.py +63 -0
- daknode/models/create_in.py +119 -0
- daknode/models/dead_letter_response.py +205 -0
- daknode/models/erasure_request_body.py +60 -0
- daknode/models/http_validation_error.py +97 -0
- daknode/models/inbox_create_request.py +120 -0
- daknode/models/inbox_response.py +148 -0
- daknode/models/message_out.py +309 -0
- daknode/models/message_page.py +116 -0
- daknode/models/read_erasure_request_response_read_erasure_request.py +63 -0
- daknode/models/replay_response.py +113 -0
- daknode/models/revoke_request.py +74 -0
- daknode/models/revoke_response_revoke.py +63 -0
- daknode/models/search_match.py +170 -0
- daknode/models/search_request.py +107 -0
- daknode/models/search_response.py +124 -0
- daknode/models/send_request.py +162 -0
- daknode/models/send_response_send.py +63 -0
- daknode/models/signup_in.py +63 -0
- daknode/models/signup_out.py +102 -0
- daknode/models/thread_detail_out.py +223 -0
- daknode/models/thread_out.py +163 -0
- daknode/models/thread_page.py +116 -0
- daknode/models/timeline_item_out.py +280 -0
- daknode/models/update_in.py +111 -0
- daknode/models/validation_error.py +141 -0
- daknode/models/validation_error_context.py +63 -0
- daknode/models/verify_in.py +67 -0
- daknode/models/verify_out.py +74 -0
- daknode/models/webhook_register_request.py +74 -0
- daknode/models/workspace_list_out.py +92 -0
- daknode/models/workspace_out.py +147 -0
- daknode/py.typed +1 -0
- daknode/types.py +53 -0
- daknode-0.1.0.dist-info/METADATA +143 -0
- daknode-0.1.0.dist-info/RECORD +84 -0
- daknode-0.1.0.dist-info/WHEEL +4 -0
daknode/__init__.py
ADDED
daknode/api/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains methods for accessing the API """
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
10
|
+
from ...models.block_rule_create import BlockRuleCreate
|
|
11
|
+
from ...models.block_rule_out import BlockRuleOut
|
|
12
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
*,
|
|
19
|
+
body: BlockRuleCreate,
|
|
20
|
+
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
_kwargs: dict[str, Any] = {
|
|
30
|
+
"method": "post",
|
|
31
|
+
"url": "/v1/block-rules",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_kwargs["json"] = body.to_dict()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
headers["Content-Type"] = "application/json"
|
|
38
|
+
|
|
39
|
+
_kwargs["headers"] = headers
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[BlockRuleOut, HTTPValidationError]]:
|
|
44
|
+
if response.status_code == 201:
|
|
45
|
+
response_201 = BlockRuleOut.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
return response_201
|
|
50
|
+
if response.status_code == 422:
|
|
51
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return response_422
|
|
56
|
+
if client.raise_on_unexpected_status:
|
|
57
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
58
|
+
else:
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[BlockRuleOut, HTTPValidationError]]:
|
|
63
|
+
return Response(
|
|
64
|
+
status_code=HTTPStatus(response.status_code),
|
|
65
|
+
content=response.content,
|
|
66
|
+
headers=response.headers,
|
|
67
|
+
parsed=_parse_response(client=client, response=response),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def sync_detailed(
|
|
72
|
+
*,
|
|
73
|
+
client: AuthenticatedClient,
|
|
74
|
+
body: BlockRuleCreate,
|
|
75
|
+
|
|
76
|
+
) -> Response[Union[BlockRuleOut, HTTPValidationError]]:
|
|
77
|
+
""" Create Block Rule
|
|
78
|
+
|
|
79
|
+
Refuse inbound mail from a sender across the whole Workspace.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
body (BlockRuleCreate): `kind` is deliberately absent.
|
|
83
|
+
|
|
84
|
+
It is DERIVED from the pattern — presence of `@` decides address versus
|
|
85
|
+
domain. A client that could assert `kind` could mislabel a rule and make the
|
|
86
|
+
matcher silently wrong; not accepting the field means the conflict cannot
|
|
87
|
+
arise, rather than relying on the CHECK constraint to catch it later.
|
|
88
|
+
|
|
89
|
+
Raises:
|
|
90
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
91
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
Response[Union[BlockRuleOut, HTTPValidationError]]
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
kwargs = _get_kwargs(
|
|
99
|
+
body=body,
|
|
100
|
+
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
response = client.get_httpx_client().request(
|
|
104
|
+
**kwargs,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
return _build_response(client=client, response=response)
|
|
108
|
+
|
|
109
|
+
def sync(
|
|
110
|
+
*,
|
|
111
|
+
client: AuthenticatedClient,
|
|
112
|
+
body: BlockRuleCreate,
|
|
113
|
+
|
|
114
|
+
) -> Optional[Union[BlockRuleOut, HTTPValidationError]]:
|
|
115
|
+
""" Create Block Rule
|
|
116
|
+
|
|
117
|
+
Refuse inbound mail from a sender across the whole Workspace.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
body (BlockRuleCreate): `kind` is deliberately absent.
|
|
121
|
+
|
|
122
|
+
It is DERIVED from the pattern — presence of `@` decides address versus
|
|
123
|
+
domain. A client that could assert `kind` could mislabel a rule and make the
|
|
124
|
+
matcher silently wrong; not accepting the field means the conflict cannot
|
|
125
|
+
arise, rather than relying on the CHECK constraint to catch it later.
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
Union[BlockRuleOut, HTTPValidationError]
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
return sync_detailed(
|
|
137
|
+
client=client,
|
|
138
|
+
body=body,
|
|
139
|
+
|
|
140
|
+
).parsed
|
|
141
|
+
|
|
142
|
+
async def asyncio_detailed(
|
|
143
|
+
*,
|
|
144
|
+
client: AuthenticatedClient,
|
|
145
|
+
body: BlockRuleCreate,
|
|
146
|
+
|
|
147
|
+
) -> Response[Union[BlockRuleOut, HTTPValidationError]]:
|
|
148
|
+
""" Create Block Rule
|
|
149
|
+
|
|
150
|
+
Refuse inbound mail from a sender across the whole Workspace.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
body (BlockRuleCreate): `kind` is deliberately absent.
|
|
154
|
+
|
|
155
|
+
It is DERIVED from the pattern — presence of `@` decides address versus
|
|
156
|
+
domain. A client that could assert `kind` could mislabel a rule and make the
|
|
157
|
+
matcher silently wrong; not accepting the field means the conflict cannot
|
|
158
|
+
arise, rather than relying on the CHECK constraint to catch it later.
|
|
159
|
+
|
|
160
|
+
Raises:
|
|
161
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
162
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
Response[Union[BlockRuleOut, HTTPValidationError]]
|
|
166
|
+
"""
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
kwargs = _get_kwargs(
|
|
170
|
+
body=body,
|
|
171
|
+
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
response = await client.get_async_httpx_client().request(
|
|
175
|
+
**kwargs
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
return _build_response(client=client, response=response)
|
|
179
|
+
|
|
180
|
+
async def asyncio(
|
|
181
|
+
*,
|
|
182
|
+
client: AuthenticatedClient,
|
|
183
|
+
body: BlockRuleCreate,
|
|
184
|
+
|
|
185
|
+
) -> Optional[Union[BlockRuleOut, HTTPValidationError]]:
|
|
186
|
+
""" Create Block Rule
|
|
187
|
+
|
|
188
|
+
Refuse inbound mail from a sender across the whole Workspace.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
body (BlockRuleCreate): `kind` is deliberately absent.
|
|
192
|
+
|
|
193
|
+
It is DERIVED from the pattern — presence of `@` decides address versus
|
|
194
|
+
domain. A client that could assert `kind` could mislabel a rule and make the
|
|
195
|
+
matcher silently wrong; not accepting the field means the conflict cannot
|
|
196
|
+
arise, rather than relying on the CHECK constraint to catch it later.
|
|
197
|
+
|
|
198
|
+
Raises:
|
|
199
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
200
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
Union[BlockRuleOut, HTTPValidationError]
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
return (await asyncio_detailed(
|
|
208
|
+
client=client,
|
|
209
|
+
body=body,
|
|
210
|
+
|
|
211
|
+
)).parsed
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
10
|
+
from ...models.block_rule_create import BlockRuleCreate
|
|
11
|
+
from ...models.block_rule_out import BlockRuleOut
|
|
12
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
13
|
+
from typing import cast
|
|
14
|
+
from uuid import UUID
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
inbox_id: UUID,
|
|
20
|
+
*,
|
|
21
|
+
body: BlockRuleCreate,
|
|
22
|
+
|
|
23
|
+
) -> dict[str, Any]:
|
|
24
|
+
headers: dict[str, Any] = {}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
_kwargs: dict[str, Any] = {
|
|
32
|
+
"method": "post",
|
|
33
|
+
"url": "/v1/inboxes/{inbox_id}/block-rules".format(inbox_id=inbox_id,),
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_kwargs["json"] = body.to_dict()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
headers["Content-Type"] = "application/json"
|
|
40
|
+
|
|
41
|
+
_kwargs["headers"] = headers
|
|
42
|
+
return _kwargs
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[BlockRuleOut, HTTPValidationError]]:
|
|
46
|
+
if response.status_code == 201:
|
|
47
|
+
response_201 = BlockRuleOut.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
return response_201
|
|
52
|
+
if response.status_code == 422:
|
|
53
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
return response_422
|
|
58
|
+
if client.raise_on_unexpected_status:
|
|
59
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
60
|
+
else:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[BlockRuleOut, HTTPValidationError]]:
|
|
65
|
+
return Response(
|
|
66
|
+
status_code=HTTPStatus(response.status_code),
|
|
67
|
+
content=response.content,
|
|
68
|
+
headers=response.headers,
|
|
69
|
+
parsed=_parse_response(client=client, response=response),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def sync_detailed(
|
|
74
|
+
inbox_id: UUID,
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient,
|
|
77
|
+
body: BlockRuleCreate,
|
|
78
|
+
|
|
79
|
+
) -> Response[Union[BlockRuleOut, HTTPValidationError]]:
|
|
80
|
+
""" Create Inbox Block Rule
|
|
81
|
+
|
|
82
|
+
Refuse inbound mail from a sender, for this inbox only.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
inbox_id (UUID):
|
|
86
|
+
body (BlockRuleCreate): `kind` is deliberately absent.
|
|
87
|
+
|
|
88
|
+
It is DERIVED from the pattern — presence of `@` decides address versus
|
|
89
|
+
domain. A client that could assert `kind` could mislabel a rule and make the
|
|
90
|
+
matcher silently wrong; not accepting the field means the conflict cannot
|
|
91
|
+
arise, rather than relying on the CHECK constraint to catch it later.
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
95
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
Response[Union[BlockRuleOut, HTTPValidationError]]
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
kwargs = _get_kwargs(
|
|
103
|
+
inbox_id=inbox_id,
|
|
104
|
+
body=body,
|
|
105
|
+
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
response = client.get_httpx_client().request(
|
|
109
|
+
**kwargs,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return _build_response(client=client, response=response)
|
|
113
|
+
|
|
114
|
+
def sync(
|
|
115
|
+
inbox_id: UUID,
|
|
116
|
+
*,
|
|
117
|
+
client: AuthenticatedClient,
|
|
118
|
+
body: BlockRuleCreate,
|
|
119
|
+
|
|
120
|
+
) -> Optional[Union[BlockRuleOut, HTTPValidationError]]:
|
|
121
|
+
""" Create Inbox Block Rule
|
|
122
|
+
|
|
123
|
+
Refuse inbound mail from a sender, for this inbox only.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
inbox_id (UUID):
|
|
127
|
+
body (BlockRuleCreate): `kind` is deliberately absent.
|
|
128
|
+
|
|
129
|
+
It is DERIVED from the pattern — presence of `@` decides address versus
|
|
130
|
+
domain. A client that could assert `kind` could mislabel a rule and make the
|
|
131
|
+
matcher silently wrong; not accepting the field means the conflict cannot
|
|
132
|
+
arise, rather than relying on the CHECK constraint to catch it later.
|
|
133
|
+
|
|
134
|
+
Raises:
|
|
135
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
136
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
137
|
+
|
|
138
|
+
Returns:
|
|
139
|
+
Union[BlockRuleOut, HTTPValidationError]
|
|
140
|
+
"""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
return sync_detailed(
|
|
144
|
+
inbox_id=inbox_id,
|
|
145
|
+
client=client,
|
|
146
|
+
body=body,
|
|
147
|
+
|
|
148
|
+
).parsed
|
|
149
|
+
|
|
150
|
+
async def asyncio_detailed(
|
|
151
|
+
inbox_id: UUID,
|
|
152
|
+
*,
|
|
153
|
+
client: AuthenticatedClient,
|
|
154
|
+
body: BlockRuleCreate,
|
|
155
|
+
|
|
156
|
+
) -> Response[Union[BlockRuleOut, HTTPValidationError]]:
|
|
157
|
+
""" Create Inbox Block Rule
|
|
158
|
+
|
|
159
|
+
Refuse inbound mail from a sender, for this inbox only.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
inbox_id (UUID):
|
|
163
|
+
body (BlockRuleCreate): `kind` is deliberately absent.
|
|
164
|
+
|
|
165
|
+
It is DERIVED from the pattern — presence of `@` decides address versus
|
|
166
|
+
domain. A client that could assert `kind` could mislabel a rule and make the
|
|
167
|
+
matcher silently wrong; not accepting the field means the conflict cannot
|
|
168
|
+
arise, rather than relying on the CHECK constraint to catch it later.
|
|
169
|
+
|
|
170
|
+
Raises:
|
|
171
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
172
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
Response[Union[BlockRuleOut, HTTPValidationError]]
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
kwargs = _get_kwargs(
|
|
180
|
+
inbox_id=inbox_id,
|
|
181
|
+
body=body,
|
|
182
|
+
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
response = await client.get_async_httpx_client().request(
|
|
186
|
+
**kwargs
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
return _build_response(client=client, response=response)
|
|
190
|
+
|
|
191
|
+
async def asyncio(
|
|
192
|
+
inbox_id: UUID,
|
|
193
|
+
*,
|
|
194
|
+
client: AuthenticatedClient,
|
|
195
|
+
body: BlockRuleCreate,
|
|
196
|
+
|
|
197
|
+
) -> Optional[Union[BlockRuleOut, HTTPValidationError]]:
|
|
198
|
+
""" Create Inbox Block Rule
|
|
199
|
+
|
|
200
|
+
Refuse inbound mail from a sender, for this inbox only.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
inbox_id (UUID):
|
|
204
|
+
body (BlockRuleCreate): `kind` is deliberately absent.
|
|
205
|
+
|
|
206
|
+
It is DERIVED from the pattern — presence of `@` decides address versus
|
|
207
|
+
domain. A client that could assert `kind` could mislabel a rule and make the
|
|
208
|
+
matcher silently wrong; not accepting the field means the conflict cannot
|
|
209
|
+
arise, rather than relying on the CHECK constraint to catch it later.
|
|
210
|
+
|
|
211
|
+
Raises:
|
|
212
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
213
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
Union[BlockRuleOut, HTTPValidationError]
|
|
217
|
+
"""
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
return (await asyncio_detailed(
|
|
221
|
+
inbox_id=inbox_id,
|
|
222
|
+
client=client,
|
|
223
|
+
body=body,
|
|
224
|
+
|
|
225
|
+
)).parsed
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union, cast
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ...client import AuthenticatedClient, Client
|
|
7
|
+
from ...types import Response, UNSET
|
|
8
|
+
from ... import errors
|
|
9
|
+
|
|
10
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
11
|
+
from typing import cast
|
|
12
|
+
from uuid import UUID
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
rule_id: UUID,
|
|
18
|
+
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
_kwargs: dict[str, Any] = {
|
|
27
|
+
"method": "delete",
|
|
28
|
+
"url": "/v1/block-rules/{rule_id}".format(rule_id=rule_id,),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
return _kwargs
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
|
|
36
|
+
if response.status_code == 204:
|
|
37
|
+
response_204 = cast(Any, None)
|
|
38
|
+
return response_204
|
|
39
|
+
if response.status_code == 422:
|
|
40
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
return response_422
|
|
45
|
+
if client.raise_on_unexpected_status:
|
|
46
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
47
|
+
else:
|
|
48
|
+
return None
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
|
|
52
|
+
return Response(
|
|
53
|
+
status_code=HTTPStatus(response.status_code),
|
|
54
|
+
content=response.content,
|
|
55
|
+
headers=response.headers,
|
|
56
|
+
parsed=_parse_response(client=client, response=response),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def sync_detailed(
|
|
61
|
+
rule_id: UUID,
|
|
62
|
+
*,
|
|
63
|
+
client: AuthenticatedClient,
|
|
64
|
+
|
|
65
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
66
|
+
""" Delete Block Rule
|
|
67
|
+
|
|
68
|
+
Stop a rule blocking. **Soft delete — block records are preserved.**
|
|
69
|
+
|
|
70
|
+
Hard-deleting would strand the evidence that mail was refused. The audit
|
|
71
|
+
trail outlives the rule that created it.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
rule_id (UUID):
|
|
75
|
+
|
|
76
|
+
Raises:
|
|
77
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
78
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
Response[Union[Any, HTTPValidationError]]
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
kwargs = _get_kwargs(
|
|
86
|
+
rule_id=rule_id,
|
|
87
|
+
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
response = client.get_httpx_client().request(
|
|
91
|
+
**kwargs,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return _build_response(client=client, response=response)
|
|
95
|
+
|
|
96
|
+
def sync(
|
|
97
|
+
rule_id: UUID,
|
|
98
|
+
*,
|
|
99
|
+
client: AuthenticatedClient,
|
|
100
|
+
|
|
101
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
102
|
+
""" Delete Block Rule
|
|
103
|
+
|
|
104
|
+
Stop a rule blocking. **Soft delete — block records are preserved.**
|
|
105
|
+
|
|
106
|
+
Hard-deleting would strand the evidence that mail was refused. The audit
|
|
107
|
+
trail outlives the rule that created it.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
rule_id (UUID):
|
|
111
|
+
|
|
112
|
+
Raises:
|
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
Union[Any, HTTPValidationError]
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
return sync_detailed(
|
|
122
|
+
rule_id=rule_id,
|
|
123
|
+
client=client,
|
|
124
|
+
|
|
125
|
+
).parsed
|
|
126
|
+
|
|
127
|
+
async def asyncio_detailed(
|
|
128
|
+
rule_id: UUID,
|
|
129
|
+
*,
|
|
130
|
+
client: AuthenticatedClient,
|
|
131
|
+
|
|
132
|
+
) -> Response[Union[Any, HTTPValidationError]]:
|
|
133
|
+
""" Delete Block Rule
|
|
134
|
+
|
|
135
|
+
Stop a rule blocking. **Soft delete — block records are preserved.**
|
|
136
|
+
|
|
137
|
+
Hard-deleting would strand the evidence that mail was refused. The audit
|
|
138
|
+
trail outlives the rule that created it.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
rule_id (UUID):
|
|
142
|
+
|
|
143
|
+
Raises:
|
|
144
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
145
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
Response[Union[Any, HTTPValidationError]]
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
kwargs = _get_kwargs(
|
|
153
|
+
rule_id=rule_id,
|
|
154
|
+
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
response = await client.get_async_httpx_client().request(
|
|
158
|
+
**kwargs
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
return _build_response(client=client, response=response)
|
|
162
|
+
|
|
163
|
+
async def asyncio(
|
|
164
|
+
rule_id: UUID,
|
|
165
|
+
*,
|
|
166
|
+
client: AuthenticatedClient,
|
|
167
|
+
|
|
168
|
+
) -> Optional[Union[Any, HTTPValidationError]]:
|
|
169
|
+
""" Delete Block Rule
|
|
170
|
+
|
|
171
|
+
Stop a rule blocking. **Soft delete — block records are preserved.**
|
|
172
|
+
|
|
173
|
+
Hard-deleting would strand the evidence that mail was refused. The audit
|
|
174
|
+
trail outlives the rule that created it.
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
rule_id (UUID):
|
|
178
|
+
|
|
179
|
+
Raises:
|
|
180
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
181
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
Union[Any, HTTPValidationError]
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
return (await asyncio_detailed(
|
|
189
|
+
rule_id=rule_id,
|
|
190
|
+
client=client,
|
|
191
|
+
|
|
192
|
+
)).parsed
|