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,198 @@
|
|
|
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.dead_letter_response import DeadLetterResponse
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import UNSET, Unset
|
|
13
|
+
from typing import cast
|
|
14
|
+
from typing import Union
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
*,
|
|
20
|
+
limit: Union[Unset, int] = 50,
|
|
21
|
+
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
params: dict[str, Any] = {}
|
|
28
|
+
|
|
29
|
+
params["limit"] = limit
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
_kwargs: dict[str, Any] = {
|
|
36
|
+
"method": "get",
|
|
37
|
+
"url": "/v1/webhooks/dead-letters",
|
|
38
|
+
"params": params,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
return _kwargs
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[HTTPValidationError, list['DeadLetterResponse']]]:
|
|
46
|
+
if response.status_code == 200:
|
|
47
|
+
response_200 = []
|
|
48
|
+
_response_200 = response.json()
|
|
49
|
+
for response_200_item_data in (_response_200):
|
|
50
|
+
response_200_item = DeadLetterResponse.from_dict(response_200_item_data)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
response_200.append(response_200_item)
|
|
55
|
+
|
|
56
|
+
return response_200
|
|
57
|
+
if response.status_code == 422:
|
|
58
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
return response_422
|
|
63
|
+
if client.raise_on_unexpected_status:
|
|
64
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
65
|
+
else:
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[HTTPValidationError, list['DeadLetterResponse']]]:
|
|
70
|
+
return Response(
|
|
71
|
+
status_code=HTTPStatus(response.status_code),
|
|
72
|
+
content=response.content,
|
|
73
|
+
headers=response.headers,
|
|
74
|
+
parsed=_parse_response(client=client, response=response),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def sync_detailed(
|
|
79
|
+
*,
|
|
80
|
+
client: AuthenticatedClient,
|
|
81
|
+
limit: Union[Unset, int] = 50,
|
|
82
|
+
|
|
83
|
+
) -> Response[Union[HTTPValidationError, list['DeadLetterResponse']]]:
|
|
84
|
+
""" List Dead Letters
|
|
85
|
+
|
|
86
|
+
Undeliverable events for the caller's organization, newest first.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
limit (Union[Unset, int]): Default: 50.
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Response[Union[HTTPValidationError, list['DeadLetterResponse']]]
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
kwargs = _get_kwargs(
|
|
101
|
+
limit=limit,
|
|
102
|
+
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
response = client.get_httpx_client().request(
|
|
106
|
+
**kwargs,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return _build_response(client=client, response=response)
|
|
110
|
+
|
|
111
|
+
def sync(
|
|
112
|
+
*,
|
|
113
|
+
client: AuthenticatedClient,
|
|
114
|
+
limit: Union[Unset, int] = 50,
|
|
115
|
+
|
|
116
|
+
) -> Optional[Union[HTTPValidationError, list['DeadLetterResponse']]]:
|
|
117
|
+
""" List Dead Letters
|
|
118
|
+
|
|
119
|
+
Undeliverable events for the caller's organization, newest first.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
limit (Union[Unset, int]): Default: 50.
|
|
123
|
+
|
|
124
|
+
Raises:
|
|
125
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
126
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
Union[HTTPValidationError, list['DeadLetterResponse']]
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
return sync_detailed(
|
|
134
|
+
client=client,
|
|
135
|
+
limit=limit,
|
|
136
|
+
|
|
137
|
+
).parsed
|
|
138
|
+
|
|
139
|
+
async def asyncio_detailed(
|
|
140
|
+
*,
|
|
141
|
+
client: AuthenticatedClient,
|
|
142
|
+
limit: Union[Unset, int] = 50,
|
|
143
|
+
|
|
144
|
+
) -> Response[Union[HTTPValidationError, list['DeadLetterResponse']]]:
|
|
145
|
+
""" List Dead Letters
|
|
146
|
+
|
|
147
|
+
Undeliverable events for the caller's organization, newest first.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
limit (Union[Unset, int]): Default: 50.
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
154
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
Response[Union[HTTPValidationError, list['DeadLetterResponse']]]
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
kwargs = _get_kwargs(
|
|
162
|
+
limit=limit,
|
|
163
|
+
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
response = await client.get_async_httpx_client().request(
|
|
167
|
+
**kwargs
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
return _build_response(client=client, response=response)
|
|
171
|
+
|
|
172
|
+
async def asyncio(
|
|
173
|
+
*,
|
|
174
|
+
client: AuthenticatedClient,
|
|
175
|
+
limit: Union[Unset, int] = 50,
|
|
176
|
+
|
|
177
|
+
) -> Optional[Union[HTTPValidationError, list['DeadLetterResponse']]]:
|
|
178
|
+
""" List Dead Letters
|
|
179
|
+
|
|
180
|
+
Undeliverable events for the caller's organization, newest first.
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
limit (Union[Unset, int]): Default: 50.
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
187
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
Union[HTTPValidationError, list['DeadLetterResponse']]
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
return (await asyncio_detailed(
|
|
195
|
+
client=client,
|
|
196
|
+
limit=limit,
|
|
197
|
+
|
|
198
|
+
)).parsed
|
|
@@ -0,0 +1,216 @@
|
|
|
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 ...models.replay_response import ReplayResponse
|
|
12
|
+
from typing import cast
|
|
13
|
+
from uuid import UUID
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
outbox_id: UUID,
|
|
19
|
+
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_kwargs: dict[str, Any] = {
|
|
28
|
+
"method": "post",
|
|
29
|
+
"url": "/v1/webhooks/dead-letters/{outbox_id}/replay".format(outbox_id=outbox_id,),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[HTTPValidationError, ReplayResponse]]:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = ReplayResponse.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
return response_200
|
|
43
|
+
if response.status_code == 422:
|
|
44
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return response_422
|
|
49
|
+
if client.raise_on_unexpected_status:
|
|
50
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
51
|
+
else:
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Union[HTTPValidationError, ReplayResponse]]:
|
|
56
|
+
return Response(
|
|
57
|
+
status_code=HTTPStatus(response.status_code),
|
|
58
|
+
content=response.content,
|
|
59
|
+
headers=response.headers,
|
|
60
|
+
parsed=_parse_response(client=client, response=response),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def sync_detailed(
|
|
65
|
+
outbox_id: UUID,
|
|
66
|
+
*,
|
|
67
|
+
client: AuthenticatedClient,
|
|
68
|
+
|
|
69
|
+
) -> Response[Union[HTTPValidationError, ReplayResponse]]:
|
|
70
|
+
""" Replay Dead Letter
|
|
71
|
+
|
|
72
|
+
Return one dead-lettered event to the delivery queue.
|
|
73
|
+
|
|
74
|
+
Explicit and audited: nothing automatic ever revives a dead-lettered row,
|
|
75
|
+
because exhaustion was a conclusion and re-litigating it without a human
|
|
76
|
+
would be an endless loop with more steps.
|
|
77
|
+
|
|
78
|
+
**The logic lives in `app/services/webhook_replay.py`**, shared with the
|
|
79
|
+
session-authenticated console route. This endpoint's contract — refusals,
|
|
80
|
+
status codes and response fields — is unchanged.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
outbox_id (UUID):
|
|
84
|
+
|
|
85
|
+
Raises:
|
|
86
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
87
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Response[Union[HTTPValidationError, ReplayResponse]]
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
kwargs = _get_kwargs(
|
|
95
|
+
outbox_id=outbox_id,
|
|
96
|
+
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
response = client.get_httpx_client().request(
|
|
100
|
+
**kwargs,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
return _build_response(client=client, response=response)
|
|
104
|
+
|
|
105
|
+
def sync(
|
|
106
|
+
outbox_id: UUID,
|
|
107
|
+
*,
|
|
108
|
+
client: AuthenticatedClient,
|
|
109
|
+
|
|
110
|
+
) -> Optional[Union[HTTPValidationError, ReplayResponse]]:
|
|
111
|
+
""" Replay Dead Letter
|
|
112
|
+
|
|
113
|
+
Return one dead-lettered event to the delivery queue.
|
|
114
|
+
|
|
115
|
+
Explicit and audited: nothing automatic ever revives a dead-lettered row,
|
|
116
|
+
because exhaustion was a conclusion and re-litigating it without a human
|
|
117
|
+
would be an endless loop with more steps.
|
|
118
|
+
|
|
119
|
+
**The logic lives in `app/services/webhook_replay.py`**, shared with the
|
|
120
|
+
session-authenticated console route. This endpoint's contract — refusals,
|
|
121
|
+
status codes and response fields — is unchanged.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
outbox_id (UUID):
|
|
125
|
+
|
|
126
|
+
Raises:
|
|
127
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
128
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
Union[HTTPValidationError, ReplayResponse]
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
return sync_detailed(
|
|
136
|
+
outbox_id=outbox_id,
|
|
137
|
+
client=client,
|
|
138
|
+
|
|
139
|
+
).parsed
|
|
140
|
+
|
|
141
|
+
async def asyncio_detailed(
|
|
142
|
+
outbox_id: UUID,
|
|
143
|
+
*,
|
|
144
|
+
client: AuthenticatedClient,
|
|
145
|
+
|
|
146
|
+
) -> Response[Union[HTTPValidationError, ReplayResponse]]:
|
|
147
|
+
""" Replay Dead Letter
|
|
148
|
+
|
|
149
|
+
Return one dead-lettered event to the delivery queue.
|
|
150
|
+
|
|
151
|
+
Explicit and audited: nothing automatic ever revives a dead-lettered row,
|
|
152
|
+
because exhaustion was a conclusion and re-litigating it without a human
|
|
153
|
+
would be an endless loop with more steps.
|
|
154
|
+
|
|
155
|
+
**The logic lives in `app/services/webhook_replay.py`**, shared with the
|
|
156
|
+
session-authenticated console route. This endpoint's contract — refusals,
|
|
157
|
+
status codes and response fields — is unchanged.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
outbox_id (UUID):
|
|
161
|
+
|
|
162
|
+
Raises:
|
|
163
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
164
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Response[Union[HTTPValidationError, ReplayResponse]]
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
kwargs = _get_kwargs(
|
|
172
|
+
outbox_id=outbox_id,
|
|
173
|
+
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
response = await client.get_async_httpx_client().request(
|
|
177
|
+
**kwargs
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
return _build_response(client=client, response=response)
|
|
181
|
+
|
|
182
|
+
async def asyncio(
|
|
183
|
+
outbox_id: UUID,
|
|
184
|
+
*,
|
|
185
|
+
client: AuthenticatedClient,
|
|
186
|
+
|
|
187
|
+
) -> Optional[Union[HTTPValidationError, ReplayResponse]]:
|
|
188
|
+
""" Replay Dead Letter
|
|
189
|
+
|
|
190
|
+
Return one dead-lettered event to the delivery queue.
|
|
191
|
+
|
|
192
|
+
Explicit and audited: nothing automatic ever revives a dead-lettered row,
|
|
193
|
+
because exhaustion was a conclusion and re-litigating it without a human
|
|
194
|
+
would be an endless loop with more steps.
|
|
195
|
+
|
|
196
|
+
**The logic lives in `app/services/webhook_replay.py`**, shared with the
|
|
197
|
+
session-authenticated console route. This endpoint's contract — refusals,
|
|
198
|
+
status codes and response fields — is unchanged.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
outbox_id (UUID):
|
|
202
|
+
|
|
203
|
+
Raises:
|
|
204
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
205
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
Union[HTTPValidationError, ReplayResponse]
|
|
209
|
+
"""
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
return (await asyncio_detailed(
|
|
213
|
+
outbox_id=outbox_id,
|
|
214
|
+
client=client,
|
|
215
|
+
|
|
216
|
+
)).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,183 @@
|
|
|
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 ...models.inbox_create_request import InboxCreateRequest
|
|
12
|
+
from ...models.inbox_response import InboxResponse
|
|
13
|
+
from typing import cast
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
*,
|
|
19
|
+
body: InboxCreateRequest,
|
|
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/inboxes",
|
|
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[HTTPValidationError, InboxResponse]]:
|
|
44
|
+
if response.status_code == 201:
|
|
45
|
+
response_201 = InboxResponse.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[HTTPValidationError, InboxResponse]]:
|
|
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: InboxCreateRequest,
|
|
75
|
+
|
|
76
|
+
) -> Response[Union[HTTPValidationError, InboxResponse]]:
|
|
77
|
+
""" Create Inbox
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
body (InboxCreateRequest):
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
84
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Response[Union[HTTPValidationError, InboxResponse]]
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
kwargs = _get_kwargs(
|
|
92
|
+
body=body,
|
|
93
|
+
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
response = client.get_httpx_client().request(
|
|
97
|
+
**kwargs,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
return _build_response(client=client, response=response)
|
|
101
|
+
|
|
102
|
+
def sync(
|
|
103
|
+
*,
|
|
104
|
+
client: AuthenticatedClient,
|
|
105
|
+
body: InboxCreateRequest,
|
|
106
|
+
|
|
107
|
+
) -> Optional[Union[HTTPValidationError, InboxResponse]]:
|
|
108
|
+
""" Create Inbox
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
body (InboxCreateRequest):
|
|
112
|
+
|
|
113
|
+
Raises:
|
|
114
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
115
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Union[HTTPValidationError, InboxResponse]
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
return sync_detailed(
|
|
123
|
+
client=client,
|
|
124
|
+
body=body,
|
|
125
|
+
|
|
126
|
+
).parsed
|
|
127
|
+
|
|
128
|
+
async def asyncio_detailed(
|
|
129
|
+
*,
|
|
130
|
+
client: AuthenticatedClient,
|
|
131
|
+
body: InboxCreateRequest,
|
|
132
|
+
|
|
133
|
+
) -> Response[Union[HTTPValidationError, InboxResponse]]:
|
|
134
|
+
""" Create Inbox
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
body (InboxCreateRequest):
|
|
138
|
+
|
|
139
|
+
Raises:
|
|
140
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
141
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
Response[Union[HTTPValidationError, InboxResponse]]
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
kwargs = _get_kwargs(
|
|
149
|
+
body=body,
|
|
150
|
+
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
response = await client.get_async_httpx_client().request(
|
|
154
|
+
**kwargs
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
return _build_response(client=client, response=response)
|
|
158
|
+
|
|
159
|
+
async def asyncio(
|
|
160
|
+
*,
|
|
161
|
+
client: AuthenticatedClient,
|
|
162
|
+
body: InboxCreateRequest,
|
|
163
|
+
|
|
164
|
+
) -> Optional[Union[HTTPValidationError, InboxResponse]]:
|
|
165
|
+
""" Create Inbox
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
body (InboxCreateRequest):
|
|
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
|
+
Union[HTTPValidationError, InboxResponse]
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
return (await asyncio_detailed(
|
|
180
|
+
client=client,
|
|
181
|
+
body=body,
|
|
182
|
+
|
|
183
|
+
)).parsed
|