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
|
@@ -0,0 +1,214 @@
|
|
|
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_page import BlockRulePage
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import UNSET, Unset
|
|
13
|
+
from typing import cast
|
|
14
|
+
from typing import cast, Union
|
|
15
|
+
from typing import Union
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _get_kwargs(
|
|
20
|
+
*,
|
|
21
|
+
limit: Union[Unset, int] = 25,
|
|
22
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
23
|
+
|
|
24
|
+
) -> dict[str, Any]:
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
params: dict[str, Any] = {}
|
|
30
|
+
|
|
31
|
+
params["limit"] = limit
|
|
32
|
+
|
|
33
|
+
json_cursor: Union[None, Unset, str]
|
|
34
|
+
if isinstance(cursor, Unset):
|
|
35
|
+
json_cursor = UNSET
|
|
36
|
+
else:
|
|
37
|
+
json_cursor = cursor
|
|
38
|
+
params["cursor"] = json_cursor
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
_kwargs: dict[str, Any] = {
|
|
45
|
+
"method": "get",
|
|
46
|
+
"url": "/v1/block-rules",
|
|
47
|
+
"params": params,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
return _kwargs
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[BlockRulePage, HTTPValidationError]]:
|
|
55
|
+
if response.status_code == 200:
|
|
56
|
+
response_200 = BlockRulePage.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
return response_200
|
|
61
|
+
if response.status_code == 422:
|
|
62
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
return response_422
|
|
67
|
+
if client.raise_on_unexpected_status:
|
|
68
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
69
|
+
else:
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[BlockRulePage, HTTPValidationError]]:
|
|
74
|
+
return Response(
|
|
75
|
+
status_code=HTTPStatus(response.status_code),
|
|
76
|
+
content=response.content,
|
|
77
|
+
headers=response.headers,
|
|
78
|
+
parsed=_parse_response(client=client, response=response),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def sync_detailed(
|
|
83
|
+
*,
|
|
84
|
+
client: AuthenticatedClient,
|
|
85
|
+
limit: Union[Unset, int] = 25,
|
|
86
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
87
|
+
|
|
88
|
+
) -> Response[Union[BlockRulePage, HTTPValidationError]]:
|
|
89
|
+
""" List Block Rules
|
|
90
|
+
|
|
91
|
+
Workspace-wide rules only. Use the inbox route to see what applies there.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
limit (Union[Unset, int]): Default: 25.
|
|
95
|
+
cursor (Union[None, Unset, str]):
|
|
96
|
+
|
|
97
|
+
Raises:
|
|
98
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
99
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
Response[Union[BlockRulePage, HTTPValidationError]]
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
kwargs = _get_kwargs(
|
|
107
|
+
limit=limit,
|
|
108
|
+
cursor=cursor,
|
|
109
|
+
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
response = client.get_httpx_client().request(
|
|
113
|
+
**kwargs,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return _build_response(client=client, response=response)
|
|
117
|
+
|
|
118
|
+
def sync(
|
|
119
|
+
*,
|
|
120
|
+
client: AuthenticatedClient,
|
|
121
|
+
limit: Union[Unset, int] = 25,
|
|
122
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
123
|
+
|
|
124
|
+
) -> Optional[Union[BlockRulePage, HTTPValidationError]]:
|
|
125
|
+
""" List Block Rules
|
|
126
|
+
|
|
127
|
+
Workspace-wide rules only. Use the inbox route to see what applies there.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
limit (Union[Unset, int]): Default: 25.
|
|
131
|
+
cursor (Union[None, Unset, str]):
|
|
132
|
+
|
|
133
|
+
Raises:
|
|
134
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
135
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Union[BlockRulePage, HTTPValidationError]
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
return sync_detailed(
|
|
143
|
+
client=client,
|
|
144
|
+
limit=limit,
|
|
145
|
+
cursor=cursor,
|
|
146
|
+
|
|
147
|
+
).parsed
|
|
148
|
+
|
|
149
|
+
async def asyncio_detailed(
|
|
150
|
+
*,
|
|
151
|
+
client: AuthenticatedClient,
|
|
152
|
+
limit: Union[Unset, int] = 25,
|
|
153
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
154
|
+
|
|
155
|
+
) -> Response[Union[BlockRulePage, HTTPValidationError]]:
|
|
156
|
+
""" List Block Rules
|
|
157
|
+
|
|
158
|
+
Workspace-wide rules only. Use the inbox route to see what applies there.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
limit (Union[Unset, int]): Default: 25.
|
|
162
|
+
cursor (Union[None, Unset, str]):
|
|
163
|
+
|
|
164
|
+
Raises:
|
|
165
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
166
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
167
|
+
|
|
168
|
+
Returns:
|
|
169
|
+
Response[Union[BlockRulePage, HTTPValidationError]]
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
kwargs = _get_kwargs(
|
|
174
|
+
limit=limit,
|
|
175
|
+
cursor=cursor,
|
|
176
|
+
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
response = await client.get_async_httpx_client().request(
|
|
180
|
+
**kwargs
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
return _build_response(client=client, response=response)
|
|
184
|
+
|
|
185
|
+
async def asyncio(
|
|
186
|
+
*,
|
|
187
|
+
client: AuthenticatedClient,
|
|
188
|
+
limit: Union[Unset, int] = 25,
|
|
189
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
190
|
+
|
|
191
|
+
) -> Optional[Union[BlockRulePage, HTTPValidationError]]:
|
|
192
|
+
""" List Block Rules
|
|
193
|
+
|
|
194
|
+
Workspace-wide rules only. Use the inbox route to see what applies there.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
limit (Union[Unset, int]): Default: 25.
|
|
198
|
+
cursor (Union[None, Unset, str]):
|
|
199
|
+
|
|
200
|
+
Raises:
|
|
201
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
202
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
Union[BlockRulePage, HTTPValidationError]
|
|
206
|
+
"""
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
return (await asyncio_detailed(
|
|
210
|
+
client=client,
|
|
211
|
+
limit=limit,
|
|
212
|
+
cursor=cursor,
|
|
213
|
+
|
|
214
|
+
)).parsed
|
|
@@ -0,0 +1,228 @@
|
|
|
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_page import BlockRulePage
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import UNSET, Unset
|
|
13
|
+
from typing import cast
|
|
14
|
+
from typing import cast, Union
|
|
15
|
+
from typing import Union
|
|
16
|
+
from uuid import UUID
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _get_kwargs(
|
|
21
|
+
inbox_id: UUID,
|
|
22
|
+
*,
|
|
23
|
+
limit: Union[Unset, int] = 25,
|
|
24
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
25
|
+
|
|
26
|
+
) -> dict[str, Any]:
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
params: dict[str, Any] = {}
|
|
32
|
+
|
|
33
|
+
params["limit"] = limit
|
|
34
|
+
|
|
35
|
+
json_cursor: Union[None, Unset, str]
|
|
36
|
+
if isinstance(cursor, Unset):
|
|
37
|
+
json_cursor = UNSET
|
|
38
|
+
else:
|
|
39
|
+
json_cursor = cursor
|
|
40
|
+
params["cursor"] = json_cursor
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
_kwargs: dict[str, Any] = {
|
|
47
|
+
"method": "get",
|
|
48
|
+
"url": "/v1/inboxes/{inbox_id}/block-rules".format(inbox_id=inbox_id,),
|
|
49
|
+
"params": params,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
return _kwargs
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[BlockRulePage, HTTPValidationError]]:
|
|
57
|
+
if response.status_code == 200:
|
|
58
|
+
response_200 = BlockRulePage.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
return response_200
|
|
63
|
+
if response.status_code == 422:
|
|
64
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
return response_422
|
|
69
|
+
if client.raise_on_unexpected_status:
|
|
70
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
71
|
+
else:
|
|
72
|
+
return None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[BlockRulePage, HTTPValidationError]]:
|
|
76
|
+
return Response(
|
|
77
|
+
status_code=HTTPStatus(response.status_code),
|
|
78
|
+
content=response.content,
|
|
79
|
+
headers=response.headers,
|
|
80
|
+
parsed=_parse_response(client=client, response=response),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def sync_detailed(
|
|
85
|
+
inbox_id: UUID,
|
|
86
|
+
*,
|
|
87
|
+
client: AuthenticatedClient,
|
|
88
|
+
limit: Union[Unset, int] = 25,
|
|
89
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
90
|
+
|
|
91
|
+
) -> Response[Union[BlockRulePage, HTTPValidationError]]:
|
|
92
|
+
""" List Inbox Block Rules
|
|
93
|
+
|
|
94
|
+
Everything blocking this inbox, including Workspace-wide rules.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
inbox_id (UUID):
|
|
98
|
+
limit (Union[Unset, int]): Default: 25.
|
|
99
|
+
cursor (Union[None, Unset, str]):
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Response[Union[BlockRulePage, HTTPValidationError]]
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
kwargs = _get_kwargs(
|
|
111
|
+
inbox_id=inbox_id,
|
|
112
|
+
limit=limit,
|
|
113
|
+
cursor=cursor,
|
|
114
|
+
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
response = client.get_httpx_client().request(
|
|
118
|
+
**kwargs,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
return _build_response(client=client, response=response)
|
|
122
|
+
|
|
123
|
+
def sync(
|
|
124
|
+
inbox_id: UUID,
|
|
125
|
+
*,
|
|
126
|
+
client: AuthenticatedClient,
|
|
127
|
+
limit: Union[Unset, int] = 25,
|
|
128
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
129
|
+
|
|
130
|
+
) -> Optional[Union[BlockRulePage, HTTPValidationError]]:
|
|
131
|
+
""" List Inbox Block Rules
|
|
132
|
+
|
|
133
|
+
Everything blocking this inbox, including Workspace-wide rules.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
inbox_id (UUID):
|
|
137
|
+
limit (Union[Unset, int]): Default: 25.
|
|
138
|
+
cursor (Union[None, Unset, str]):
|
|
139
|
+
|
|
140
|
+
Raises:
|
|
141
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
142
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
Union[BlockRulePage, HTTPValidationError]
|
|
146
|
+
"""
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
return sync_detailed(
|
|
150
|
+
inbox_id=inbox_id,
|
|
151
|
+
client=client,
|
|
152
|
+
limit=limit,
|
|
153
|
+
cursor=cursor,
|
|
154
|
+
|
|
155
|
+
).parsed
|
|
156
|
+
|
|
157
|
+
async def asyncio_detailed(
|
|
158
|
+
inbox_id: UUID,
|
|
159
|
+
*,
|
|
160
|
+
client: AuthenticatedClient,
|
|
161
|
+
limit: Union[Unset, int] = 25,
|
|
162
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
163
|
+
|
|
164
|
+
) -> Response[Union[BlockRulePage, HTTPValidationError]]:
|
|
165
|
+
""" List Inbox Block Rules
|
|
166
|
+
|
|
167
|
+
Everything blocking this inbox, including Workspace-wide rules.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
inbox_id (UUID):
|
|
171
|
+
limit (Union[Unset, int]): Default: 25.
|
|
172
|
+
cursor (Union[None, Unset, str]):
|
|
173
|
+
|
|
174
|
+
Raises:
|
|
175
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
176
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
Response[Union[BlockRulePage, HTTPValidationError]]
|
|
180
|
+
"""
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
kwargs = _get_kwargs(
|
|
184
|
+
inbox_id=inbox_id,
|
|
185
|
+
limit=limit,
|
|
186
|
+
cursor=cursor,
|
|
187
|
+
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
response = await client.get_async_httpx_client().request(
|
|
191
|
+
**kwargs
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
return _build_response(client=client, response=response)
|
|
195
|
+
|
|
196
|
+
async def asyncio(
|
|
197
|
+
inbox_id: UUID,
|
|
198
|
+
*,
|
|
199
|
+
client: AuthenticatedClient,
|
|
200
|
+
limit: Union[Unset, int] = 25,
|
|
201
|
+
cursor: Union[None, Unset, str] = UNSET,
|
|
202
|
+
|
|
203
|
+
) -> Optional[Union[BlockRulePage, HTTPValidationError]]:
|
|
204
|
+
""" List Inbox Block Rules
|
|
205
|
+
|
|
206
|
+
Everything blocking this inbox, including Workspace-wide rules.
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
inbox_id (UUID):
|
|
210
|
+
limit (Union[Unset, int]): Default: 25.
|
|
211
|
+
cursor (Union[None, Unset, str]):
|
|
212
|
+
|
|
213
|
+
Raises:
|
|
214
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
215
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
Union[BlockRulePage, HTTPValidationError]
|
|
219
|
+
"""
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
return (await asyncio_detailed(
|
|
223
|
+
inbox_id=inbox_id,
|
|
224
|
+
client=client,
|
|
225
|
+
limit=limit,
|
|
226
|
+
cursor=cursor,
|
|
227
|
+
|
|
228
|
+
)).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,203 @@
|
|
|
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.consent_request import ConsentRequest
|
|
11
|
+
from ...models.consent_response import ConsentResponse
|
|
12
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
*,
|
|
19
|
+
body: ConsentRequest,
|
|
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/consents",
|
|
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[ConsentResponse, HTTPValidationError]]:
|
|
44
|
+
if response.status_code == 201:
|
|
45
|
+
response_201 = ConsentResponse.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[ConsentResponse, 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: ConsentRequest,
|
|
75
|
+
|
|
76
|
+
) -> Response[Union[ConsentResponse, HTTPValidationError]]:
|
|
77
|
+
""" Create Consent
|
|
78
|
+
|
|
79
|
+
Record a declared consent for one recipient.
|
|
80
|
+
|
|
81
|
+
`created_by_key_id` comes from the authenticated context, never from the
|
|
82
|
+
body — otherwise attribution would be self-reported too.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
body (ConsentRequest):
|
|
86
|
+
|
|
87
|
+
Raises:
|
|
88
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
89
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Response[Union[ConsentResponse, HTTPValidationError]]
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
kwargs = _get_kwargs(
|
|
97
|
+
body=body,
|
|
98
|
+
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
response = client.get_httpx_client().request(
|
|
102
|
+
**kwargs,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return _build_response(client=client, response=response)
|
|
106
|
+
|
|
107
|
+
def sync(
|
|
108
|
+
*,
|
|
109
|
+
client: AuthenticatedClient,
|
|
110
|
+
body: ConsentRequest,
|
|
111
|
+
|
|
112
|
+
) -> Optional[Union[ConsentResponse, HTTPValidationError]]:
|
|
113
|
+
""" Create Consent
|
|
114
|
+
|
|
115
|
+
Record a declared consent for one recipient.
|
|
116
|
+
|
|
117
|
+
`created_by_key_id` comes from the authenticated context, never from the
|
|
118
|
+
body — otherwise attribution would be self-reported too.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
body (ConsentRequest):
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
125
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
Union[ConsentResponse, HTTPValidationError]
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
return sync_detailed(
|
|
133
|
+
client=client,
|
|
134
|
+
body=body,
|
|
135
|
+
|
|
136
|
+
).parsed
|
|
137
|
+
|
|
138
|
+
async def asyncio_detailed(
|
|
139
|
+
*,
|
|
140
|
+
client: AuthenticatedClient,
|
|
141
|
+
body: ConsentRequest,
|
|
142
|
+
|
|
143
|
+
) -> Response[Union[ConsentResponse, HTTPValidationError]]:
|
|
144
|
+
""" Create Consent
|
|
145
|
+
|
|
146
|
+
Record a declared consent for one recipient.
|
|
147
|
+
|
|
148
|
+
`created_by_key_id` comes from the authenticated context, never from the
|
|
149
|
+
body — otherwise attribution would be self-reported too.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
body (ConsentRequest):
|
|
153
|
+
|
|
154
|
+
Raises:
|
|
155
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
156
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
Response[Union[ConsentResponse, HTTPValidationError]]
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
kwargs = _get_kwargs(
|
|
164
|
+
body=body,
|
|
165
|
+
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
response = await client.get_async_httpx_client().request(
|
|
169
|
+
**kwargs
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
return _build_response(client=client, response=response)
|
|
173
|
+
|
|
174
|
+
async def asyncio(
|
|
175
|
+
*,
|
|
176
|
+
client: AuthenticatedClient,
|
|
177
|
+
body: ConsentRequest,
|
|
178
|
+
|
|
179
|
+
) -> Optional[Union[ConsentResponse, HTTPValidationError]]:
|
|
180
|
+
""" Create Consent
|
|
181
|
+
|
|
182
|
+
Record a declared consent for one recipient.
|
|
183
|
+
|
|
184
|
+
`created_by_key_id` comes from the authenticated context, never from the
|
|
185
|
+
body — otherwise attribution would be self-reported too.
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
body (ConsentRequest):
|
|
189
|
+
|
|
190
|
+
Raises:
|
|
191
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
192
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
193
|
+
|
|
194
|
+
Returns:
|
|
195
|
+
Union[ConsentResponse, HTTPValidationError]
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
return (await asyncio_detailed(
|
|
200
|
+
client=client,
|
|
201
|
+
body=body,
|
|
202
|
+
|
|
203
|
+
)).parsed
|