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,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.http_validation_error import HTTPValidationError
|
|
11
|
+
from ...models.inbox_response import InboxResponse
|
|
12
|
+
from ...models.webhook_register_request import WebhookRegisterRequest
|
|
13
|
+
from typing import cast
|
|
14
|
+
from uuid import UUID
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
inbox_id: UUID,
|
|
20
|
+
*,
|
|
21
|
+
body: WebhookRegisterRequest,
|
|
22
|
+
|
|
23
|
+
) -> dict[str, Any]:
|
|
24
|
+
headers: dict[str, Any] = {}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
_kwargs: dict[str, Any] = {
|
|
32
|
+
"method": "put",
|
|
33
|
+
"url": "/v1/inboxes/{inbox_id}/webhook".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[HTTPValidationError, InboxResponse]]:
|
|
46
|
+
if response.status_code == 200:
|
|
47
|
+
response_200 = InboxResponse.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
return response_200
|
|
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[HTTPValidationError, InboxResponse]]:
|
|
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: WebhookRegisterRequest,
|
|
78
|
+
|
|
79
|
+
) -> Response[Union[HTTPValidationError, InboxResponse]]:
|
|
80
|
+
""" Register Webhook
|
|
81
|
+
|
|
82
|
+
Register or replace an inbox's webhook destination.
|
|
83
|
+
|
|
84
|
+
Idempotent (PUT): registering the same URL twice is a no-op, and returns no
|
|
85
|
+
secret. Pointing the inbox at a **different** destination mints a fresh
|
|
86
|
+
secret and returns it once — a new destination is a new party, and it must
|
|
87
|
+
not inherit the credential the previous one holds (specs/04_webhooks.md §3a).
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
inbox_id (UUID):
|
|
91
|
+
body (WebhookRegisterRequest):
|
|
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[HTTPValidationError, InboxResponse]]
|
|
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: WebhookRegisterRequest,
|
|
119
|
+
|
|
120
|
+
) -> Optional[Union[HTTPValidationError, InboxResponse]]:
|
|
121
|
+
""" Register Webhook
|
|
122
|
+
|
|
123
|
+
Register or replace an inbox's webhook destination.
|
|
124
|
+
|
|
125
|
+
Idempotent (PUT): registering the same URL twice is a no-op, and returns no
|
|
126
|
+
secret. Pointing the inbox at a **different** destination mints a fresh
|
|
127
|
+
secret and returns it once — a new destination is a new party, and it must
|
|
128
|
+
not inherit the credential the previous one holds (specs/04_webhooks.md §3a).
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
inbox_id (UUID):
|
|
132
|
+
body (WebhookRegisterRequest):
|
|
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[HTTPValidationError, InboxResponse]
|
|
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: WebhookRegisterRequest,
|
|
155
|
+
|
|
156
|
+
) -> Response[Union[HTTPValidationError, InboxResponse]]:
|
|
157
|
+
""" Register Webhook
|
|
158
|
+
|
|
159
|
+
Register or replace an inbox's webhook destination.
|
|
160
|
+
|
|
161
|
+
Idempotent (PUT): registering the same URL twice is a no-op, and returns no
|
|
162
|
+
secret. Pointing the inbox at a **different** destination mints a fresh
|
|
163
|
+
secret and returns it once — a new destination is a new party, and it must
|
|
164
|
+
not inherit the credential the previous one holds (specs/04_webhooks.md §3a).
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
inbox_id (UUID):
|
|
168
|
+
body (WebhookRegisterRequest):
|
|
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[HTTPValidationError, InboxResponse]]
|
|
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: WebhookRegisterRequest,
|
|
196
|
+
|
|
197
|
+
) -> Optional[Union[HTTPValidationError, InboxResponse]]:
|
|
198
|
+
""" Register Webhook
|
|
199
|
+
|
|
200
|
+
Register or replace an inbox's webhook destination.
|
|
201
|
+
|
|
202
|
+
Idempotent (PUT): registering the same URL twice is a no-op, and returns no
|
|
203
|
+
secret. Pointing the inbox at a **different** destination mints a fresh
|
|
204
|
+
secret and returns it once — a new destination is a new party, and it must
|
|
205
|
+
not inherit the credential the previous one holds (specs/04_webhooks.md §3a).
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
inbox_id (UUID):
|
|
209
|
+
body (WebhookRegisterRequest):
|
|
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[HTTPValidationError, InboxResponse]
|
|
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,224 @@
|
|
|
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_response import InboxResponse
|
|
12
|
+
from typing import cast
|
|
13
|
+
from uuid import UUID
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
inbox_id: UUID,
|
|
19
|
+
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_kwargs: dict[str, Any] = {
|
|
28
|
+
"method": "post",
|
|
29
|
+
"url": "/v1/inboxes/{inbox_id}/webhook/rotate".format(inbox_id=inbox_id,),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[HTTPValidationError, InboxResponse]]:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = InboxResponse.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, InboxResponse]]:
|
|
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
|
+
inbox_id: UUID,
|
|
66
|
+
*,
|
|
67
|
+
client: AuthenticatedClient,
|
|
68
|
+
|
|
69
|
+
) -> Response[Union[HTTPValidationError, InboxResponse]]:
|
|
70
|
+
""" Rotate Webhook Secret
|
|
71
|
+
|
|
72
|
+
Mint a new signing secret for the same destination, returned once.
|
|
73
|
+
|
|
74
|
+
This exists because `PUT` cannot serve the purpose: `PUT` with the same URL
|
|
75
|
+
is a no-op by design, so without this endpoint a customer whose secret
|
|
76
|
+
leaked had no way to replace it short of moving to a different URL.
|
|
77
|
+
|
|
78
|
+
The destination is unchanged, so `webhook_registration_id` is **not**
|
|
79
|
+
touched and pending events stay deliverable — they will be signed with the
|
|
80
|
+
new secret, which the same receiving party has just been handed. Cancelling
|
|
81
|
+
them would discard legitimate undelivered events over a credential change
|
|
82
|
+
the receiver initiated (specs/04_webhooks.md §3c).
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
inbox_id (UUID):
|
|
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[HTTPValidationError, InboxResponse]]
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
kwargs = _get_kwargs(
|
|
97
|
+
inbox_id=inbox_id,
|
|
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
|
+
inbox_id: UUID,
|
|
109
|
+
*,
|
|
110
|
+
client: AuthenticatedClient,
|
|
111
|
+
|
|
112
|
+
) -> Optional[Union[HTTPValidationError, InboxResponse]]:
|
|
113
|
+
""" Rotate Webhook Secret
|
|
114
|
+
|
|
115
|
+
Mint a new signing secret for the same destination, returned once.
|
|
116
|
+
|
|
117
|
+
This exists because `PUT` cannot serve the purpose: `PUT` with the same URL
|
|
118
|
+
is a no-op by design, so without this endpoint a customer whose secret
|
|
119
|
+
leaked had no way to replace it short of moving to a different URL.
|
|
120
|
+
|
|
121
|
+
The destination is unchanged, so `webhook_registration_id` is **not**
|
|
122
|
+
touched and pending events stay deliverable — they will be signed with the
|
|
123
|
+
new secret, which the same receiving party has just been handed. Cancelling
|
|
124
|
+
them would discard legitimate undelivered events over a credential change
|
|
125
|
+
the receiver initiated (specs/04_webhooks.md §3c).
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
inbox_id (UUID):
|
|
129
|
+
|
|
130
|
+
Raises:
|
|
131
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
132
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
Union[HTTPValidationError, InboxResponse]
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
return sync_detailed(
|
|
140
|
+
inbox_id=inbox_id,
|
|
141
|
+
client=client,
|
|
142
|
+
|
|
143
|
+
).parsed
|
|
144
|
+
|
|
145
|
+
async def asyncio_detailed(
|
|
146
|
+
inbox_id: UUID,
|
|
147
|
+
*,
|
|
148
|
+
client: AuthenticatedClient,
|
|
149
|
+
|
|
150
|
+
) -> Response[Union[HTTPValidationError, InboxResponse]]:
|
|
151
|
+
""" Rotate Webhook Secret
|
|
152
|
+
|
|
153
|
+
Mint a new signing secret for the same destination, returned once.
|
|
154
|
+
|
|
155
|
+
This exists because `PUT` cannot serve the purpose: `PUT` with the same URL
|
|
156
|
+
is a no-op by design, so without this endpoint a customer whose secret
|
|
157
|
+
leaked had no way to replace it short of moving to a different URL.
|
|
158
|
+
|
|
159
|
+
The destination is unchanged, so `webhook_registration_id` is **not**
|
|
160
|
+
touched and pending events stay deliverable — they will be signed with the
|
|
161
|
+
new secret, which the same receiving party has just been handed. Cancelling
|
|
162
|
+
them would discard legitimate undelivered events over a credential change
|
|
163
|
+
the receiver initiated (specs/04_webhooks.md §3c).
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
inbox_id (UUID):
|
|
167
|
+
|
|
168
|
+
Raises:
|
|
169
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
170
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Response[Union[HTTPValidationError, InboxResponse]]
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
kwargs = _get_kwargs(
|
|
178
|
+
inbox_id=inbox_id,
|
|
179
|
+
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
response = await client.get_async_httpx_client().request(
|
|
183
|
+
**kwargs
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
return _build_response(client=client, response=response)
|
|
187
|
+
|
|
188
|
+
async def asyncio(
|
|
189
|
+
inbox_id: UUID,
|
|
190
|
+
*,
|
|
191
|
+
client: AuthenticatedClient,
|
|
192
|
+
|
|
193
|
+
) -> Optional[Union[HTTPValidationError, InboxResponse]]:
|
|
194
|
+
""" Rotate Webhook Secret
|
|
195
|
+
|
|
196
|
+
Mint a new signing secret for the same destination, returned once.
|
|
197
|
+
|
|
198
|
+
This exists because `PUT` cannot serve the purpose: `PUT` with the same URL
|
|
199
|
+
is a no-op by design, so without this endpoint a customer whose secret
|
|
200
|
+
leaked had no way to replace it short of moving to a different URL.
|
|
201
|
+
|
|
202
|
+
The destination is unchanged, so `webhook_registration_id` is **not**
|
|
203
|
+
touched and pending events stay deliverable — they will be signed with the
|
|
204
|
+
new secret, which the same receiving party has just been handed. Cancelling
|
|
205
|
+
them would discard legitimate undelivered events over a credential change
|
|
206
|
+
the receiver initiated (specs/04_webhooks.md §3c).
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
inbox_id (UUID):
|
|
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[HTTPValidationError, InboxResponse]
|
|
217
|
+
"""
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
return (await asyncio_detailed(
|
|
221
|
+
inbox_id=inbox_id,
|
|
222
|
+
client=client,
|
|
223
|
+
|
|
224
|
+
)).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,176 @@
|
|
|
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.message_out import MessageOut
|
|
12
|
+
from typing import cast
|
|
13
|
+
from uuid import UUID
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
message_id: UUID,
|
|
19
|
+
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_kwargs: dict[str, Any] = {
|
|
28
|
+
"method": "get",
|
|
29
|
+
"url": "/v1/messages/{message_id}".format(message_id=message_id,),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Union[HTTPValidationError, MessageOut]]:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = MessageOut.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, MessageOut]]:
|
|
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
|
+
message_id: UUID,
|
|
66
|
+
*,
|
|
67
|
+
client: AuthenticatedClient,
|
|
68
|
+
|
|
69
|
+
) -> Response[Union[HTTPValidationError, MessageOut]]:
|
|
70
|
+
""" Get Message
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
message_id (UUID):
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
77
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
Response[Union[HTTPValidationError, MessageOut]]
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
kwargs = _get_kwargs(
|
|
85
|
+
message_id=message_id,
|
|
86
|
+
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
response = client.get_httpx_client().request(
|
|
90
|
+
**kwargs,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return _build_response(client=client, response=response)
|
|
94
|
+
|
|
95
|
+
def sync(
|
|
96
|
+
message_id: UUID,
|
|
97
|
+
*,
|
|
98
|
+
client: AuthenticatedClient,
|
|
99
|
+
|
|
100
|
+
) -> Optional[Union[HTTPValidationError, MessageOut]]:
|
|
101
|
+
""" Get Message
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
message_id (UUID):
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
108
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Union[HTTPValidationError, MessageOut]
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return sync_detailed(
|
|
116
|
+
message_id=message_id,
|
|
117
|
+
client=client,
|
|
118
|
+
|
|
119
|
+
).parsed
|
|
120
|
+
|
|
121
|
+
async def asyncio_detailed(
|
|
122
|
+
message_id: UUID,
|
|
123
|
+
*,
|
|
124
|
+
client: AuthenticatedClient,
|
|
125
|
+
|
|
126
|
+
) -> Response[Union[HTTPValidationError, MessageOut]]:
|
|
127
|
+
""" Get Message
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
message_id (UUID):
|
|
131
|
+
|
|
132
|
+
Raises:
|
|
133
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
134
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
Response[Union[HTTPValidationError, MessageOut]]
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
kwargs = _get_kwargs(
|
|
142
|
+
message_id=message_id,
|
|
143
|
+
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
response = await client.get_async_httpx_client().request(
|
|
147
|
+
**kwargs
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
return _build_response(client=client, response=response)
|
|
151
|
+
|
|
152
|
+
async def asyncio(
|
|
153
|
+
message_id: UUID,
|
|
154
|
+
*,
|
|
155
|
+
client: AuthenticatedClient,
|
|
156
|
+
|
|
157
|
+
) -> Optional[Union[HTTPValidationError, MessageOut]]:
|
|
158
|
+
""" Get Message
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
message_id (UUID):
|
|
162
|
+
|
|
163
|
+
Raises:
|
|
164
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
165
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
Union[HTTPValidationError, MessageOut]
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
return (await asyncio_detailed(
|
|
173
|
+
message_id=message_id,
|
|
174
|
+
client=client,
|
|
175
|
+
|
|
176
|
+
)).parsed
|