airweave-sdk 0.8.65__py3-none-any.whl → 0.8.66__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.
- airweave/__init__.py +41 -43
- airweave/client.py +0 -16
- airweave/collections/__init__.py +3 -6
- airweave/collections/client.py +273 -113
- airweave/collections/raw_client.py +633 -94
- airweave/collections/types/__init__.py +2 -4
- airweave/core/client_wrapper.py +4 -30
- airweave/errors/__init__.py +10 -2
- airweave/errors/conflict_error.py +11 -0
- airweave/errors/not_found_error.py +11 -0
- airweave/errors/too_many_requests_error.py +11 -0
- airweave/errors/unprocessable_entity_error.py +1 -2
- airweave/events/client.py +281 -500
- airweave/events/raw_client.py +562 -551
- airweave/source_connections/client.py +210 -162
- airweave/source_connections/raw_client.py +574 -137
- airweave/sources/client.py +42 -18
- airweave/sources/raw_client.py +118 -17
- airweave/types/__init__.py +33 -39
- airweave/types/{endpoint_secret_out.py → conflict_error_response.py} +12 -2
- airweave/types/delivery_attempt.py +61 -0
- airweave/types/event_message.py +55 -0
- airweave/types/event_message_with_attempts.py +59 -0
- airweave/types/{enable_endpoint_request.py → not_found_error_response.py} +6 -4
- airweave/types/{subscription_with_attempts_out.py → rate_limit_error_response.py} +9 -6
- airweave/types/recovery_task.py +35 -0
- airweave/types/search_request.py +13 -10
- airweave/types/search_response.py +6 -3
- airweave/types/source_connection.py +73 -18
- airweave/types/source_connection_job.py +65 -15
- airweave/types/source_connection_list_item.py +45 -10
- airweave/types/sync_event_payload.py +72 -0
- airweave/types/{recover_out.py → validation_error_detail.py} +19 -6
- airweave/types/validation_error_response.py +30 -0
- airweave/types/webhook_subscription.py +68 -0
- {airweave_sdk-0.8.65.dist-info → airweave_sdk-0.8.66.dist-info}/METADATA +1 -5
- {airweave_sdk-0.8.65.dist-info → airweave_sdk-0.8.66.dist-info}/RECORD +38 -38
- airweave/collections/types/search_collections_readable_id_search_post_response.py +0 -8
- airweave/types/background_task_status.py +0 -5
- airweave/types/background_task_type.py +0 -17
- airweave/types/collection_update.py +0 -35
- airweave/types/endpoint_out.py +0 -35
- airweave/types/message_attempt_out.py +0 -37
- airweave/types/message_attempt_trigger_type.py +0 -3
- airweave/types/message_out.py +0 -29
- airweave/types/message_status.py +0 -3
- airweave/types/message_status_text.py +0 -5
- {airweave_sdk-0.8.65.dist-info → airweave_sdk-0.8.66.dist-info}/WHEEL +0 -0
airweave/events/client.py
CHANGED
|
@@ -5,14 +5,11 @@ import typing
|
|
|
5
5
|
|
|
6
6
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
7
|
from ..core.request_options import RequestOptions
|
|
8
|
-
from ..types.
|
|
9
|
-
from ..types.
|
|
10
|
-
from ..types.endpoint_secret_out import EndpointSecretOut
|
|
8
|
+
from ..types.event_message import EventMessage
|
|
9
|
+
from ..types.event_message_with_attempts import EventMessageWithAttempts
|
|
11
10
|
from ..types.event_type import EventType
|
|
12
|
-
from ..types.
|
|
13
|
-
from ..types.
|
|
14
|
-
from ..types.recover_out import RecoverOut
|
|
15
|
-
from ..types.subscription_with_attempts_out import SubscriptionWithAttemptsOut
|
|
11
|
+
from ..types.recovery_task import RecoveryTask
|
|
12
|
+
from ..types.webhook_subscription import WebhookSubscription
|
|
16
13
|
from .raw_client import AsyncRawEventsClient, RawEventsClient
|
|
17
14
|
|
|
18
15
|
# this is used as the default value for optional parameters
|
|
@@ -39,36 +36,35 @@ class EventsClient:
|
|
|
39
36
|
*,
|
|
40
37
|
event_types: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
41
38
|
request_options: typing.Optional[RequestOptions] = None,
|
|
42
|
-
) -> typing.List[
|
|
39
|
+
) -> typing.List[EventMessage]:
|
|
43
40
|
"""
|
|
44
|
-
|
|
41
|
+
Retrieve all event messages for your organization.
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
Event messages represent webhook payloads that were sent (or attempted to be sent)
|
|
44
|
+
to your subscribed endpoints. Each message contains the event type, payload data,
|
|
45
|
+
and delivery status information.
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
Use the `event_types` query parameter to filter messages by specific event types,
|
|
48
|
+
such as `sync.completed` or `sync.failed`.
|
|
52
49
|
|
|
53
50
|
Parameters
|
|
54
51
|
----------
|
|
55
52
|
event_types : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
53
|
+
Filter messages by event type(s). Accepts multiple values, e.g., `?event_types=sync.completed&event_types=sync.failed`.
|
|
56
54
|
|
|
57
55
|
request_options : typing.Optional[RequestOptions]
|
|
58
56
|
Request-specific configuration.
|
|
59
57
|
|
|
60
58
|
Returns
|
|
61
59
|
-------
|
|
62
|
-
typing.List[
|
|
63
|
-
|
|
60
|
+
typing.List[EventMessage]
|
|
61
|
+
List of event messages
|
|
64
62
|
|
|
65
63
|
Examples
|
|
66
64
|
--------
|
|
67
65
|
from airweave import AirweaveSDK
|
|
68
66
|
|
|
69
67
|
client = AirweaveSDK(
|
|
70
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
71
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
72
68
|
api_key="YOUR_API_KEY",
|
|
73
69
|
)
|
|
74
70
|
client.events.get_messages()
|
|
@@ -76,95 +72,66 @@ class EventsClient:
|
|
|
76
72
|
_response = self._raw_client.get_messages(event_types=event_types, request_options=request_options)
|
|
77
73
|
return _response.data
|
|
78
74
|
|
|
79
|
-
def get_message(
|
|
75
|
+
def get_message(
|
|
76
|
+
self,
|
|
77
|
+
message_id: str,
|
|
78
|
+
*,
|
|
79
|
+
include_attempts: typing.Optional[bool] = None,
|
|
80
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
81
|
+
) -> EventMessageWithAttempts:
|
|
80
82
|
"""
|
|
81
|
-
|
|
83
|
+
Retrieve a specific event message by its ID.
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
Returns the full message details including the event type, payload data,
|
|
86
|
+
timestamp, and delivery channel information. Use this to inspect the
|
|
87
|
+
exact payload that was sent to your webhook endpoints.
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
Use `include_attempts=true` to also retrieve delivery attempts for this message,
|
|
90
|
+
which include HTTP response codes, response bodies, and timestamps for debugging
|
|
91
|
+
delivery failures.
|
|
89
92
|
|
|
90
93
|
Parameters
|
|
91
94
|
----------
|
|
92
95
|
message_id : str
|
|
96
|
+
The unique identifier of the message to retrieve (UUID).
|
|
97
|
+
|
|
98
|
+
include_attempts : typing.Optional[bool]
|
|
99
|
+
Include delivery attempts for this message. Each attempt includes the HTTP response code, response body, and timestamp.
|
|
93
100
|
|
|
94
101
|
request_options : typing.Optional[RequestOptions]
|
|
95
102
|
Request-specific configuration.
|
|
96
103
|
|
|
97
104
|
Returns
|
|
98
105
|
-------
|
|
99
|
-
|
|
100
|
-
|
|
106
|
+
EventMessageWithAttempts
|
|
107
|
+
Event message details
|
|
101
108
|
|
|
102
109
|
Examples
|
|
103
110
|
--------
|
|
104
111
|
from airweave import AirweaveSDK
|
|
105
112
|
|
|
106
113
|
client = AirweaveSDK(
|
|
107
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
108
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
109
114
|
api_key="YOUR_API_KEY",
|
|
110
115
|
)
|
|
111
116
|
client.events.get_message(
|
|
112
|
-
message_id="
|
|
117
|
+
message_id="550e8400-e29b-41d4-a716-446655440000",
|
|
118
|
+
include_attempts=True,
|
|
113
119
|
)
|
|
114
120
|
"""
|
|
115
|
-
_response = self._raw_client.get_message(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
def get_message_attempts(
|
|
119
|
-
self, message_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
120
|
-
) -> typing.List[MessageAttemptOut]:
|
|
121
|
-
"""
|
|
122
|
-
Get delivery attempts for a specific message.
|
|
123
|
-
|
|
124
|
-
Args:
|
|
125
|
-
message_id: The ID of the message.
|
|
126
|
-
ctx: The API context containing organization info.
|
|
127
|
-
|
|
128
|
-
Returns:
|
|
129
|
-
List of delivery attempts for this message.
|
|
130
|
-
|
|
131
|
-
Parameters
|
|
132
|
-
----------
|
|
133
|
-
message_id : str
|
|
134
|
-
|
|
135
|
-
request_options : typing.Optional[RequestOptions]
|
|
136
|
-
Request-specific configuration.
|
|
137
|
-
|
|
138
|
-
Returns
|
|
139
|
-
-------
|
|
140
|
-
typing.List[MessageAttemptOut]
|
|
141
|
-
Successful Response
|
|
142
|
-
|
|
143
|
-
Examples
|
|
144
|
-
--------
|
|
145
|
-
from airweave import AirweaveSDK
|
|
146
|
-
|
|
147
|
-
client = AirweaveSDK(
|
|
148
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
149
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
150
|
-
api_key="YOUR_API_KEY",
|
|
151
|
-
)
|
|
152
|
-
client.events.get_message_attempts(
|
|
153
|
-
message_id="message_id",
|
|
121
|
+
_response = self._raw_client.get_message(
|
|
122
|
+
message_id, include_attempts=include_attempts, request_options=request_options
|
|
154
123
|
)
|
|
155
|
-
"""
|
|
156
|
-
_response = self._raw_client.get_message_attempts(message_id, request_options=request_options)
|
|
157
124
|
return _response.data
|
|
158
125
|
|
|
159
|
-
def get_subscriptions(
|
|
126
|
+
def get_subscriptions(
|
|
127
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
128
|
+
) -> typing.List[WebhookSubscription]:
|
|
160
129
|
"""
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
Args:
|
|
164
|
-
ctx: The API context containing organization info.
|
|
130
|
+
List all webhook subscriptions for your organization.
|
|
165
131
|
|
|
166
|
-
Returns
|
|
167
|
-
|
|
132
|
+
Returns all configured webhook endpoints, including their URLs, subscribed
|
|
133
|
+
event types, and current status (enabled/disabled). Use this to audit
|
|
134
|
+
your webhook configuration or find a specific subscription.
|
|
168
135
|
|
|
169
136
|
Parameters
|
|
170
137
|
----------
|
|
@@ -173,16 +140,14 @@ class EventsClient:
|
|
|
173
140
|
|
|
174
141
|
Returns
|
|
175
142
|
-------
|
|
176
|
-
typing.List[
|
|
177
|
-
|
|
143
|
+
typing.List[WebhookSubscription]
|
|
144
|
+
List of webhook subscriptions
|
|
178
145
|
|
|
179
146
|
Examples
|
|
180
147
|
--------
|
|
181
148
|
from airweave import AirweaveSDK
|
|
182
149
|
|
|
183
150
|
client = AirweaveSDK(
|
|
184
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
185
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
186
151
|
api_key="YOUR_API_KEY",
|
|
187
152
|
)
|
|
188
153
|
client.events.get_subscriptions()
|
|
@@ -197,45 +162,49 @@ class EventsClient:
|
|
|
197
162
|
event_types: typing.Sequence[EventType],
|
|
198
163
|
secret: typing.Optional[str] = OMIT,
|
|
199
164
|
request_options: typing.Optional[RequestOptions] = None,
|
|
200
|
-
) ->
|
|
165
|
+
) -> WebhookSubscription:
|
|
201
166
|
"""
|
|
202
167
|
Create a new webhook subscription.
|
|
203
168
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
ctx: The API context containing organization info.
|
|
169
|
+
Webhook subscriptions allow you to receive real-time notifications when events
|
|
170
|
+
occur in Airweave. When you create a subscription, you specify:
|
|
207
171
|
|
|
208
|
-
|
|
209
|
-
|
|
172
|
+
- **URL**: The HTTPS endpoint where events will be delivered
|
|
173
|
+
- **Event Types**: Which events you want to receive (e.g., `sync.completed`, `sync.failed`)
|
|
174
|
+
- **Secret** (optional): A custom signing secret for verifying webhook signatures
|
|
175
|
+
|
|
176
|
+
After creation, Airweave will send HTTP POST requests to your URL whenever
|
|
177
|
+
matching events occur. Each request includes a signature header for verification.
|
|
210
178
|
|
|
211
179
|
Parameters
|
|
212
180
|
----------
|
|
213
181
|
url : str
|
|
182
|
+
The HTTPS URL where webhook events will be delivered. Must be a publicly accessible endpoint that returns a 2xx status code.
|
|
214
183
|
|
|
215
184
|
event_types : typing.Sequence[EventType]
|
|
185
|
+
List of event types to subscribe to. Events not in this list will not be delivered to this subscription. Available types: `sync.pending`, `sync.running`, `sync.completed`, `sync.failed`, `sync.cancelled`.
|
|
216
186
|
|
|
217
187
|
secret : typing.Optional[str]
|
|
188
|
+
Optional custom signing secret for webhook signature verification. If not provided, a secure secret will be auto-generated. Must be at least 24 characters if specified.
|
|
218
189
|
|
|
219
190
|
request_options : typing.Optional[RequestOptions]
|
|
220
191
|
Request-specific configuration.
|
|
221
192
|
|
|
222
193
|
Returns
|
|
223
194
|
-------
|
|
224
|
-
|
|
225
|
-
|
|
195
|
+
WebhookSubscription
|
|
196
|
+
Created subscription
|
|
226
197
|
|
|
227
198
|
Examples
|
|
228
199
|
--------
|
|
229
200
|
from airweave import AirweaveSDK
|
|
230
201
|
|
|
231
202
|
client = AirweaveSDK(
|
|
232
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
233
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
234
203
|
api_key="YOUR_API_KEY",
|
|
235
204
|
)
|
|
236
205
|
client.events.create_subscription(
|
|
237
|
-
url="
|
|
238
|
-
event_types=["sync.
|
|
206
|
+
url="https://api.mycompany.com/webhooks/airweave",
|
|
207
|
+
event_types=["sync.completed", "sync.failed"],
|
|
239
208
|
)
|
|
240
209
|
"""
|
|
241
210
|
_response = self._raw_client.create_subscription(
|
|
@@ -244,79 +213,89 @@ class EventsClient:
|
|
|
244
213
|
return _response.data
|
|
245
214
|
|
|
246
215
|
def get_subscription(
|
|
247
|
-
self,
|
|
248
|
-
|
|
216
|
+
self,
|
|
217
|
+
subscription_id: str,
|
|
218
|
+
*,
|
|
219
|
+
include_secret: typing.Optional[bool] = None,
|
|
220
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
221
|
+
) -> WebhookSubscription:
|
|
249
222
|
"""
|
|
250
|
-
|
|
223
|
+
Retrieve a specific webhook subscription with its recent delivery attempts.
|
|
251
224
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
225
|
+
Returns the subscription configuration along with a history of message delivery
|
|
226
|
+
attempts. This is useful for debugging delivery issues or verifying that your
|
|
227
|
+
endpoint is correctly receiving events.
|
|
255
228
|
|
|
256
|
-
|
|
257
|
-
|
|
229
|
+
Use `include_secret=true` to also retrieve the signing secret for webhook
|
|
230
|
+
signature verification. Keep this secret secure.
|
|
258
231
|
|
|
259
232
|
Parameters
|
|
260
233
|
----------
|
|
261
234
|
subscription_id : str
|
|
235
|
+
The unique identifier of the subscription to retrieve (UUID).
|
|
236
|
+
|
|
237
|
+
include_secret : typing.Optional[bool]
|
|
238
|
+
Include the signing secret for webhook signature verification. Keep this secret secure and use it to verify the 'svix-signature' header.
|
|
262
239
|
|
|
263
240
|
request_options : typing.Optional[RequestOptions]
|
|
264
241
|
Request-specific configuration.
|
|
265
242
|
|
|
266
243
|
Returns
|
|
267
244
|
-------
|
|
268
|
-
|
|
269
|
-
|
|
245
|
+
WebhookSubscription
|
|
246
|
+
Subscription with delivery attempts
|
|
270
247
|
|
|
271
248
|
Examples
|
|
272
249
|
--------
|
|
273
250
|
from airweave import AirweaveSDK
|
|
274
251
|
|
|
275
252
|
client = AirweaveSDK(
|
|
276
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
277
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
278
253
|
api_key="YOUR_API_KEY",
|
|
279
254
|
)
|
|
280
255
|
client.events.get_subscription(
|
|
281
|
-
subscription_id="
|
|
256
|
+
subscription_id="550e8400-e29b-41d4-a716-446655440000",
|
|
257
|
+
include_secret=True,
|
|
282
258
|
)
|
|
283
259
|
"""
|
|
284
|
-
_response = self._raw_client.get_subscription(
|
|
260
|
+
_response = self._raw_client.get_subscription(
|
|
261
|
+
subscription_id, include_secret=include_secret, request_options=request_options
|
|
262
|
+
)
|
|
285
263
|
return _response.data
|
|
286
264
|
|
|
287
265
|
def delete_subscription(
|
|
288
266
|
self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
289
|
-
) ->
|
|
267
|
+
) -> WebhookSubscription:
|
|
290
268
|
"""
|
|
291
|
-
|
|
269
|
+
Permanently delete a webhook subscription.
|
|
270
|
+
|
|
271
|
+
Once deleted, Airweave will stop sending events to this endpoint immediately.
|
|
272
|
+
This action cannot be undone. Any pending message deliveries will be cancelled.
|
|
292
273
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
ctx: The API context containing organization info.
|
|
274
|
+
If you want to temporarily stop receiving events, consider disabling the
|
|
275
|
+
subscription instead using the PATCH endpoint.
|
|
296
276
|
|
|
297
277
|
Parameters
|
|
298
278
|
----------
|
|
299
279
|
subscription_id : str
|
|
280
|
+
The unique identifier of the subscription to delete (UUID).
|
|
300
281
|
|
|
301
282
|
request_options : typing.Optional[RequestOptions]
|
|
302
283
|
Request-specific configuration.
|
|
303
284
|
|
|
304
285
|
Returns
|
|
305
286
|
-------
|
|
306
|
-
|
|
307
|
-
|
|
287
|
+
WebhookSubscription
|
|
288
|
+
Deleted subscription
|
|
308
289
|
|
|
309
290
|
Examples
|
|
310
291
|
--------
|
|
311
292
|
from airweave import AirweaveSDK
|
|
312
293
|
|
|
313
294
|
client = AirweaveSDK(
|
|
314
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
315
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
316
295
|
api_key="YOUR_API_KEY",
|
|
317
296
|
)
|
|
318
297
|
client.events.delete_subscription(
|
|
319
|
-
subscription_id="
|
|
298
|
+
subscription_id="550e8400-e29b-41d4-a716-446655440000",
|
|
320
299
|
)
|
|
321
300
|
"""
|
|
322
301
|
_response = self._raw_client.delete_subscription(subscription_id, request_options=request_options)
|
|
@@ -329,147 +308,72 @@ class EventsClient:
|
|
|
329
308
|
url: typing.Optional[str] = OMIT,
|
|
330
309
|
event_types: typing.Optional[typing.Sequence[EventType]] = OMIT,
|
|
331
310
|
disabled: typing.Optional[bool] = OMIT,
|
|
311
|
+
recover_since: typing.Optional[dt.datetime] = OMIT,
|
|
332
312
|
request_options: typing.Optional[RequestOptions] = None,
|
|
333
|
-
) ->
|
|
313
|
+
) -> WebhookSubscription:
|
|
334
314
|
"""
|
|
335
|
-
Update
|
|
315
|
+
Update an existing webhook subscription.
|
|
336
316
|
|
|
337
|
-
|
|
338
|
-
subscription_id: The ID of the subscription to update.
|
|
339
|
-
request: The subscription update request.
|
|
340
|
-
ctx: The API context containing organization info.
|
|
317
|
+
Use this endpoint to modify a subscription's configuration. You can:
|
|
341
318
|
|
|
342
|
-
|
|
343
|
-
|
|
319
|
+
- **Change the URL**: Update where events are delivered
|
|
320
|
+
- **Update event types**: Modify which events trigger notifications
|
|
321
|
+
- **Enable/disable**: Temporarily pause delivery without deleting the subscription
|
|
322
|
+
- **Recover messages**: When re-enabling, optionally recover missed messages
|
|
323
|
+
|
|
324
|
+
Only include the fields you want to change. Omitted fields will retain their
|
|
325
|
+
current values.
|
|
326
|
+
|
|
327
|
+
When re-enabling a subscription (`disabled: false`), you can optionally provide
|
|
328
|
+
`recover_since` to automatically retry all messages that were generated while
|
|
329
|
+
the subscription was disabled.
|
|
344
330
|
|
|
345
331
|
Parameters
|
|
346
332
|
----------
|
|
347
333
|
subscription_id : str
|
|
334
|
+
The unique identifier of the subscription to update (UUID).
|
|
348
335
|
|
|
349
336
|
url : typing.Optional[str]
|
|
337
|
+
New URL for webhook delivery. Must be a publicly accessible HTTPS endpoint.
|
|
350
338
|
|
|
351
339
|
event_types : typing.Optional[typing.Sequence[EventType]]
|
|
340
|
+
New list of event types to subscribe to. This replaces the existing list entirely.
|
|
352
341
|
|
|
353
342
|
disabled : typing.Optional[bool]
|
|
343
|
+
Set to `true` to pause delivery to this subscription, or `false` to resume. Disabled subscriptions will not receive events.
|
|
344
|
+
|
|
345
|
+
recover_since : typing.Optional[dt.datetime]
|
|
346
|
+
When re-enabling a subscription (`disabled: false`), optionally recover failed messages from this timestamp. Only applies when enabling.
|
|
354
347
|
|
|
355
348
|
request_options : typing.Optional[RequestOptions]
|
|
356
349
|
Request-specific configuration.
|
|
357
350
|
|
|
358
351
|
Returns
|
|
359
352
|
-------
|
|
360
|
-
|
|
361
|
-
|
|
353
|
+
WebhookSubscription
|
|
354
|
+
Updated subscription
|
|
362
355
|
|
|
363
356
|
Examples
|
|
364
357
|
--------
|
|
365
358
|
from airweave import AirweaveSDK
|
|
366
359
|
|
|
367
360
|
client = AirweaveSDK(
|
|
368
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
369
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
370
361
|
api_key="YOUR_API_KEY",
|
|
371
362
|
)
|
|
372
363
|
client.events.patch_subscription(
|
|
373
|
-
subscription_id="
|
|
364
|
+
subscription_id="550e8400-e29b-41d4-a716-446655440000",
|
|
374
365
|
)
|
|
375
366
|
"""
|
|
376
367
|
_response = self._raw_client.patch_subscription(
|
|
377
|
-
subscription_id,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
subscription_id: str,
|
|
384
|
-
*,
|
|
385
|
-
request: typing.Optional[EnableEndpointRequest] = None,
|
|
386
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
387
|
-
) -> EndpointOut:
|
|
388
|
-
"""
|
|
389
|
-
Enable a disabled webhook subscription, optionally recovering failed messages.
|
|
390
|
-
|
|
391
|
-
Args:
|
|
392
|
-
subscription_id: The ID of the subscription to enable.
|
|
393
|
-
request: Optional request with recovery time range.
|
|
394
|
-
ctx: The API context containing organization info.
|
|
395
|
-
|
|
396
|
-
Returns:
|
|
397
|
-
The enabled subscription.
|
|
398
|
-
|
|
399
|
-
Parameters
|
|
400
|
-
----------
|
|
401
|
-
subscription_id : str
|
|
402
|
-
|
|
403
|
-
request : typing.Optional[EnableEndpointRequest]
|
|
404
|
-
|
|
405
|
-
request_options : typing.Optional[RequestOptions]
|
|
406
|
-
Request-specific configuration.
|
|
407
|
-
|
|
408
|
-
Returns
|
|
409
|
-
-------
|
|
410
|
-
EndpointOut
|
|
411
|
-
Successful Response
|
|
412
|
-
|
|
413
|
-
Examples
|
|
414
|
-
--------
|
|
415
|
-
from airweave import AirweaveSDK, EnableEndpointRequest
|
|
416
|
-
|
|
417
|
-
client = AirweaveSDK(
|
|
418
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
419
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
420
|
-
api_key="YOUR_API_KEY",
|
|
421
|
-
)
|
|
422
|
-
client.events.enable_subscription(
|
|
423
|
-
subscription_id="subscription_id",
|
|
424
|
-
request=EnableEndpointRequest(),
|
|
425
|
-
)
|
|
426
|
-
"""
|
|
427
|
-
_response = self._raw_client.enable_subscription(
|
|
428
|
-
subscription_id, request=request, request_options=request_options
|
|
368
|
+
subscription_id,
|
|
369
|
+
url=url,
|
|
370
|
+
event_types=event_types,
|
|
371
|
+
disabled=disabled,
|
|
372
|
+
recover_since=recover_since,
|
|
373
|
+
request_options=request_options,
|
|
429
374
|
)
|
|
430
375
|
return _response.data
|
|
431
376
|
|
|
432
|
-
def get_subscription_secret(
|
|
433
|
-
self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
434
|
-
) -> EndpointSecretOut:
|
|
435
|
-
"""
|
|
436
|
-
Get the signing secret for a webhook subscription.
|
|
437
|
-
|
|
438
|
-
Args:
|
|
439
|
-
subscription_id: The ID of the subscription.
|
|
440
|
-
ctx: The API context containing organization info.
|
|
441
|
-
|
|
442
|
-
Returns:
|
|
443
|
-
The subscription's signing secret.
|
|
444
|
-
|
|
445
|
-
Parameters
|
|
446
|
-
----------
|
|
447
|
-
subscription_id : str
|
|
448
|
-
|
|
449
|
-
request_options : typing.Optional[RequestOptions]
|
|
450
|
-
Request-specific configuration.
|
|
451
|
-
|
|
452
|
-
Returns
|
|
453
|
-
-------
|
|
454
|
-
EndpointSecretOut
|
|
455
|
-
Successful Response
|
|
456
|
-
|
|
457
|
-
Examples
|
|
458
|
-
--------
|
|
459
|
-
from airweave import AirweaveSDK
|
|
460
|
-
|
|
461
|
-
client = AirweaveSDK(
|
|
462
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
463
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
464
|
-
api_key="YOUR_API_KEY",
|
|
465
|
-
)
|
|
466
|
-
client.events.get_subscription_secret(
|
|
467
|
-
subscription_id="subscription_id",
|
|
468
|
-
)
|
|
469
|
-
"""
|
|
470
|
-
_response = self._raw_client.get_subscription_secret(subscription_id, request_options=request_options)
|
|
471
|
-
return _response.data
|
|
472
|
-
|
|
473
377
|
def recover_failed_messages(
|
|
474
378
|
self,
|
|
475
379
|
subscription_id: str,
|
|
@@ -477,37 +381,38 @@ class EventsClient:
|
|
|
477
381
|
since: dt.datetime,
|
|
478
382
|
until: typing.Optional[dt.datetime] = OMIT,
|
|
479
383
|
request_options: typing.Optional[RequestOptions] = None,
|
|
480
|
-
) ->
|
|
384
|
+
) -> RecoveryTask:
|
|
481
385
|
"""
|
|
482
|
-
|
|
386
|
+
Retry failed message deliveries for a webhook subscription.
|
|
483
387
|
|
|
484
|
-
|
|
485
|
-
time.
|
|
486
|
-
failed while the endpoint was down.
|
|
388
|
+
Triggers a recovery process that replays all failed messages within the
|
|
389
|
+
specified time window. This is useful when:
|
|
487
390
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
ctx: The API context containing organization info.
|
|
391
|
+
- Your endpoint was temporarily down and you want to catch up
|
|
392
|
+
- You've fixed a bug in your webhook handler
|
|
393
|
+
- You want to reprocess events after re-enabling a disabled subscription
|
|
492
394
|
|
|
493
|
-
|
|
494
|
-
|
|
395
|
+
Messages are retried in chronological order. Successfully delivered messages
|
|
396
|
+
are skipped; only failed or pending messages are retried.
|
|
495
397
|
|
|
496
398
|
Parameters
|
|
497
399
|
----------
|
|
498
400
|
subscription_id : str
|
|
401
|
+
The unique identifier of the subscription to recover messages for (UUID).
|
|
499
402
|
|
|
500
403
|
since : dt.datetime
|
|
404
|
+
Start of the recovery time window (inclusive). All failed messages from this time onward will be retried.
|
|
501
405
|
|
|
502
406
|
until : typing.Optional[dt.datetime]
|
|
407
|
+
End of the recovery time window (exclusive). If not specified, recovers all failed messages up to now.
|
|
503
408
|
|
|
504
409
|
request_options : typing.Optional[RequestOptions]
|
|
505
410
|
Request-specific configuration.
|
|
506
411
|
|
|
507
412
|
Returns
|
|
508
413
|
-------
|
|
509
|
-
|
|
510
|
-
|
|
414
|
+
RecoveryTask
|
|
415
|
+
Recovery task information
|
|
511
416
|
|
|
512
417
|
Examples
|
|
513
418
|
--------
|
|
@@ -516,14 +421,12 @@ class EventsClient:
|
|
|
516
421
|
from airweave import AirweaveSDK
|
|
517
422
|
|
|
518
423
|
client = AirweaveSDK(
|
|
519
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
520
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
521
424
|
api_key="YOUR_API_KEY",
|
|
522
425
|
)
|
|
523
426
|
client.events.recover_failed_messages(
|
|
524
|
-
subscription_id="
|
|
427
|
+
subscription_id="550e8400-e29b-41d4-a716-446655440000",
|
|
525
428
|
since=datetime.datetime.fromisoformat(
|
|
526
|
-
"2024-
|
|
429
|
+
"2024-03-14 00:00:00+00:00",
|
|
527
430
|
),
|
|
528
431
|
)
|
|
529
432
|
"""
|
|
@@ -553,28 +456,29 @@ class AsyncEventsClient:
|
|
|
553
456
|
*,
|
|
554
457
|
event_types: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
555
458
|
request_options: typing.Optional[RequestOptions] = None,
|
|
556
|
-
) -> typing.List[
|
|
459
|
+
) -> typing.List[EventMessage]:
|
|
557
460
|
"""
|
|
558
|
-
|
|
461
|
+
Retrieve all event messages for your organization.
|
|
559
462
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
463
|
+
Event messages represent webhook payloads that were sent (or attempted to be sent)
|
|
464
|
+
to your subscribed endpoints. Each message contains the event type, payload data,
|
|
465
|
+
and delivery status information.
|
|
563
466
|
|
|
564
|
-
|
|
565
|
-
|
|
467
|
+
Use the `event_types` query parameter to filter messages by specific event types,
|
|
468
|
+
such as `sync.completed` or `sync.failed`.
|
|
566
469
|
|
|
567
470
|
Parameters
|
|
568
471
|
----------
|
|
569
472
|
event_types : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
473
|
+
Filter messages by event type(s). Accepts multiple values, e.g., `?event_types=sync.completed&event_types=sync.failed`.
|
|
570
474
|
|
|
571
475
|
request_options : typing.Optional[RequestOptions]
|
|
572
476
|
Request-specific configuration.
|
|
573
477
|
|
|
574
478
|
Returns
|
|
575
479
|
-------
|
|
576
|
-
typing.List[
|
|
577
|
-
|
|
480
|
+
typing.List[EventMessage]
|
|
481
|
+
List of event messages
|
|
578
482
|
|
|
579
483
|
Examples
|
|
580
484
|
--------
|
|
@@ -583,8 +487,6 @@ class AsyncEventsClient:
|
|
|
583
487
|
from airweave import AsyncAirweaveSDK
|
|
584
488
|
|
|
585
489
|
client = AsyncAirweaveSDK(
|
|
586
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
587
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
588
490
|
api_key="YOUR_API_KEY",
|
|
589
491
|
)
|
|
590
492
|
|
|
@@ -599,29 +501,38 @@ class AsyncEventsClient:
|
|
|
599
501
|
return _response.data
|
|
600
502
|
|
|
601
503
|
async def get_message(
|
|
602
|
-
self,
|
|
603
|
-
|
|
504
|
+
self,
|
|
505
|
+
message_id: str,
|
|
506
|
+
*,
|
|
507
|
+
include_attempts: typing.Optional[bool] = None,
|
|
508
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
509
|
+
) -> EventMessageWithAttempts:
|
|
604
510
|
"""
|
|
605
|
-
|
|
511
|
+
Retrieve a specific event message by its ID.
|
|
606
512
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
513
|
+
Returns the full message details including the event type, payload data,
|
|
514
|
+
timestamp, and delivery channel information. Use this to inspect the
|
|
515
|
+
exact payload that was sent to your webhook endpoints.
|
|
610
516
|
|
|
611
|
-
|
|
612
|
-
|
|
517
|
+
Use `include_attempts=true` to also retrieve delivery attempts for this message,
|
|
518
|
+
which include HTTP response codes, response bodies, and timestamps for debugging
|
|
519
|
+
delivery failures.
|
|
613
520
|
|
|
614
521
|
Parameters
|
|
615
522
|
----------
|
|
616
523
|
message_id : str
|
|
524
|
+
The unique identifier of the message to retrieve (UUID).
|
|
525
|
+
|
|
526
|
+
include_attempts : typing.Optional[bool]
|
|
527
|
+
Include delivery attempts for this message. Each attempt includes the HTTP response code, response body, and timestamp.
|
|
617
528
|
|
|
618
529
|
request_options : typing.Optional[RequestOptions]
|
|
619
530
|
Request-specific configuration.
|
|
620
531
|
|
|
621
532
|
Returns
|
|
622
533
|
-------
|
|
623
|
-
|
|
624
|
-
|
|
534
|
+
EventMessageWithAttempts
|
|
535
|
+
Event message details
|
|
625
536
|
|
|
626
537
|
Examples
|
|
627
538
|
--------
|
|
@@ -630,83 +541,33 @@ class AsyncEventsClient:
|
|
|
630
541
|
from airweave import AsyncAirweaveSDK
|
|
631
542
|
|
|
632
543
|
client = AsyncAirweaveSDK(
|
|
633
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
634
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
635
544
|
api_key="YOUR_API_KEY",
|
|
636
545
|
)
|
|
637
546
|
|
|
638
547
|
|
|
639
548
|
async def main() -> None:
|
|
640
549
|
await client.events.get_message(
|
|
641
|
-
message_id="
|
|
550
|
+
message_id="550e8400-e29b-41d4-a716-446655440000",
|
|
551
|
+
include_attempts=True,
|
|
642
552
|
)
|
|
643
553
|
|
|
644
554
|
|
|
645
555
|
asyncio.run(main())
|
|
646
556
|
"""
|
|
647
|
-
_response = await self._raw_client.get_message(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
async def get_message_attempts(
|
|
651
|
-
self, message_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
652
|
-
) -> typing.List[MessageAttemptOut]:
|
|
653
|
-
"""
|
|
654
|
-
Get delivery attempts for a specific message.
|
|
655
|
-
|
|
656
|
-
Args:
|
|
657
|
-
message_id: The ID of the message.
|
|
658
|
-
ctx: The API context containing organization info.
|
|
659
|
-
|
|
660
|
-
Returns:
|
|
661
|
-
List of delivery attempts for this message.
|
|
662
|
-
|
|
663
|
-
Parameters
|
|
664
|
-
----------
|
|
665
|
-
message_id : str
|
|
666
|
-
|
|
667
|
-
request_options : typing.Optional[RequestOptions]
|
|
668
|
-
Request-specific configuration.
|
|
669
|
-
|
|
670
|
-
Returns
|
|
671
|
-
-------
|
|
672
|
-
typing.List[MessageAttemptOut]
|
|
673
|
-
Successful Response
|
|
674
|
-
|
|
675
|
-
Examples
|
|
676
|
-
--------
|
|
677
|
-
import asyncio
|
|
678
|
-
|
|
679
|
-
from airweave import AsyncAirweaveSDK
|
|
680
|
-
|
|
681
|
-
client = AsyncAirweaveSDK(
|
|
682
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
683
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
684
|
-
api_key="YOUR_API_KEY",
|
|
557
|
+
_response = await self._raw_client.get_message(
|
|
558
|
+
message_id, include_attempts=include_attempts, request_options=request_options
|
|
685
559
|
)
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
async def main() -> None:
|
|
689
|
-
await client.events.get_message_attempts(
|
|
690
|
-
message_id="message_id",
|
|
691
|
-
)
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
asyncio.run(main())
|
|
695
|
-
"""
|
|
696
|
-
_response = await self._raw_client.get_message_attempts(message_id, request_options=request_options)
|
|
697
560
|
return _response.data
|
|
698
561
|
|
|
699
562
|
async def get_subscriptions(
|
|
700
563
|
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
701
|
-
) -> typing.List[
|
|
564
|
+
) -> typing.List[WebhookSubscription]:
|
|
702
565
|
"""
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
Args:
|
|
706
|
-
ctx: The API context containing organization info.
|
|
566
|
+
List all webhook subscriptions for your organization.
|
|
707
567
|
|
|
708
|
-
Returns
|
|
709
|
-
|
|
568
|
+
Returns all configured webhook endpoints, including their URLs, subscribed
|
|
569
|
+
event types, and current status (enabled/disabled). Use this to audit
|
|
570
|
+
your webhook configuration or find a specific subscription.
|
|
710
571
|
|
|
711
572
|
Parameters
|
|
712
573
|
----------
|
|
@@ -715,8 +576,8 @@ class AsyncEventsClient:
|
|
|
715
576
|
|
|
716
577
|
Returns
|
|
717
578
|
-------
|
|
718
|
-
typing.List[
|
|
719
|
-
|
|
579
|
+
typing.List[WebhookSubscription]
|
|
580
|
+
List of webhook subscriptions
|
|
720
581
|
|
|
721
582
|
Examples
|
|
722
583
|
--------
|
|
@@ -725,8 +586,6 @@ class AsyncEventsClient:
|
|
|
725
586
|
from airweave import AsyncAirweaveSDK
|
|
726
587
|
|
|
727
588
|
client = AsyncAirweaveSDK(
|
|
728
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
729
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
730
589
|
api_key="YOUR_API_KEY",
|
|
731
590
|
)
|
|
732
591
|
|
|
@@ -747,32 +606,38 @@ class AsyncEventsClient:
|
|
|
747
606
|
event_types: typing.Sequence[EventType],
|
|
748
607
|
secret: typing.Optional[str] = OMIT,
|
|
749
608
|
request_options: typing.Optional[RequestOptions] = None,
|
|
750
|
-
) ->
|
|
609
|
+
) -> WebhookSubscription:
|
|
751
610
|
"""
|
|
752
611
|
Create a new webhook subscription.
|
|
753
612
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
ctx: The API context containing organization info.
|
|
613
|
+
Webhook subscriptions allow you to receive real-time notifications when events
|
|
614
|
+
occur in Airweave. When you create a subscription, you specify:
|
|
757
615
|
|
|
758
|
-
|
|
759
|
-
|
|
616
|
+
- **URL**: The HTTPS endpoint where events will be delivered
|
|
617
|
+
- **Event Types**: Which events you want to receive (e.g., `sync.completed`, `sync.failed`)
|
|
618
|
+
- **Secret** (optional): A custom signing secret for verifying webhook signatures
|
|
619
|
+
|
|
620
|
+
After creation, Airweave will send HTTP POST requests to your URL whenever
|
|
621
|
+
matching events occur. Each request includes a signature header for verification.
|
|
760
622
|
|
|
761
623
|
Parameters
|
|
762
624
|
----------
|
|
763
625
|
url : str
|
|
626
|
+
The HTTPS URL where webhook events will be delivered. Must be a publicly accessible endpoint that returns a 2xx status code.
|
|
764
627
|
|
|
765
628
|
event_types : typing.Sequence[EventType]
|
|
629
|
+
List of event types to subscribe to. Events not in this list will not be delivered to this subscription. Available types: `sync.pending`, `sync.running`, `sync.completed`, `sync.failed`, `sync.cancelled`.
|
|
766
630
|
|
|
767
631
|
secret : typing.Optional[str]
|
|
632
|
+
Optional custom signing secret for webhook signature verification. If not provided, a secure secret will be auto-generated. Must be at least 24 characters if specified.
|
|
768
633
|
|
|
769
634
|
request_options : typing.Optional[RequestOptions]
|
|
770
635
|
Request-specific configuration.
|
|
771
636
|
|
|
772
637
|
Returns
|
|
773
638
|
-------
|
|
774
|
-
|
|
775
|
-
|
|
639
|
+
WebhookSubscription
|
|
640
|
+
Created subscription
|
|
776
641
|
|
|
777
642
|
Examples
|
|
778
643
|
--------
|
|
@@ -781,16 +646,14 @@ class AsyncEventsClient:
|
|
|
781
646
|
from airweave import AsyncAirweaveSDK
|
|
782
647
|
|
|
783
648
|
client = AsyncAirweaveSDK(
|
|
784
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
785
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
786
649
|
api_key="YOUR_API_KEY",
|
|
787
650
|
)
|
|
788
651
|
|
|
789
652
|
|
|
790
653
|
async def main() -> None:
|
|
791
654
|
await client.events.create_subscription(
|
|
792
|
-
url="
|
|
793
|
-
event_types=["sync.
|
|
655
|
+
url="https://api.mycompany.com/webhooks/airweave",
|
|
656
|
+
event_types=["sync.completed", "sync.failed"],
|
|
794
657
|
)
|
|
795
658
|
|
|
796
659
|
|
|
@@ -802,29 +665,37 @@ class AsyncEventsClient:
|
|
|
802
665
|
return _response.data
|
|
803
666
|
|
|
804
667
|
async def get_subscription(
|
|
805
|
-
self,
|
|
806
|
-
|
|
668
|
+
self,
|
|
669
|
+
subscription_id: str,
|
|
670
|
+
*,
|
|
671
|
+
include_secret: typing.Optional[bool] = None,
|
|
672
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
673
|
+
) -> WebhookSubscription:
|
|
807
674
|
"""
|
|
808
|
-
|
|
675
|
+
Retrieve a specific webhook subscription with its recent delivery attempts.
|
|
809
676
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
677
|
+
Returns the subscription configuration along with a history of message delivery
|
|
678
|
+
attempts. This is useful for debugging delivery issues or verifying that your
|
|
679
|
+
endpoint is correctly receiving events.
|
|
813
680
|
|
|
814
|
-
|
|
815
|
-
|
|
681
|
+
Use `include_secret=true` to also retrieve the signing secret for webhook
|
|
682
|
+
signature verification. Keep this secret secure.
|
|
816
683
|
|
|
817
684
|
Parameters
|
|
818
685
|
----------
|
|
819
686
|
subscription_id : str
|
|
687
|
+
The unique identifier of the subscription to retrieve (UUID).
|
|
688
|
+
|
|
689
|
+
include_secret : typing.Optional[bool]
|
|
690
|
+
Include the signing secret for webhook signature verification. Keep this secret secure and use it to verify the 'svix-signature' header.
|
|
820
691
|
|
|
821
692
|
request_options : typing.Optional[RequestOptions]
|
|
822
693
|
Request-specific configuration.
|
|
823
694
|
|
|
824
695
|
Returns
|
|
825
696
|
-------
|
|
826
|
-
|
|
827
|
-
|
|
697
|
+
WebhookSubscription
|
|
698
|
+
Subscription with delivery attempts
|
|
828
699
|
|
|
829
700
|
Examples
|
|
830
701
|
--------
|
|
@@ -833,44 +704,48 @@ class AsyncEventsClient:
|
|
|
833
704
|
from airweave import AsyncAirweaveSDK
|
|
834
705
|
|
|
835
706
|
client = AsyncAirweaveSDK(
|
|
836
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
837
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
838
707
|
api_key="YOUR_API_KEY",
|
|
839
708
|
)
|
|
840
709
|
|
|
841
710
|
|
|
842
711
|
async def main() -> None:
|
|
843
712
|
await client.events.get_subscription(
|
|
844
|
-
subscription_id="
|
|
713
|
+
subscription_id="550e8400-e29b-41d4-a716-446655440000",
|
|
714
|
+
include_secret=True,
|
|
845
715
|
)
|
|
846
716
|
|
|
847
717
|
|
|
848
718
|
asyncio.run(main())
|
|
849
719
|
"""
|
|
850
|
-
_response = await self._raw_client.get_subscription(
|
|
720
|
+
_response = await self._raw_client.get_subscription(
|
|
721
|
+
subscription_id, include_secret=include_secret, request_options=request_options
|
|
722
|
+
)
|
|
851
723
|
return _response.data
|
|
852
724
|
|
|
853
725
|
async def delete_subscription(
|
|
854
726
|
self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
855
|
-
) ->
|
|
727
|
+
) -> WebhookSubscription:
|
|
856
728
|
"""
|
|
857
|
-
|
|
729
|
+
Permanently delete a webhook subscription.
|
|
730
|
+
|
|
731
|
+
Once deleted, Airweave will stop sending events to this endpoint immediately.
|
|
732
|
+
This action cannot be undone. Any pending message deliveries will be cancelled.
|
|
858
733
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
ctx: The API context containing organization info.
|
|
734
|
+
If you want to temporarily stop receiving events, consider disabling the
|
|
735
|
+
subscription instead using the PATCH endpoint.
|
|
862
736
|
|
|
863
737
|
Parameters
|
|
864
738
|
----------
|
|
865
739
|
subscription_id : str
|
|
740
|
+
The unique identifier of the subscription to delete (UUID).
|
|
866
741
|
|
|
867
742
|
request_options : typing.Optional[RequestOptions]
|
|
868
743
|
Request-specific configuration.
|
|
869
744
|
|
|
870
745
|
Returns
|
|
871
746
|
-------
|
|
872
|
-
|
|
873
|
-
|
|
747
|
+
WebhookSubscription
|
|
748
|
+
Deleted subscription
|
|
874
749
|
|
|
875
750
|
Examples
|
|
876
751
|
--------
|
|
@@ -879,15 +754,13 @@ class AsyncEventsClient:
|
|
|
879
754
|
from airweave import AsyncAirweaveSDK
|
|
880
755
|
|
|
881
756
|
client = AsyncAirweaveSDK(
|
|
882
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
883
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
884
757
|
api_key="YOUR_API_KEY",
|
|
885
758
|
)
|
|
886
759
|
|
|
887
760
|
|
|
888
761
|
async def main() -> None:
|
|
889
762
|
await client.events.delete_subscription(
|
|
890
|
-
subscription_id="
|
|
763
|
+
subscription_id="550e8400-e29b-41d4-a716-446655440000",
|
|
891
764
|
)
|
|
892
765
|
|
|
893
766
|
|
|
@@ -903,36 +776,50 @@ class AsyncEventsClient:
|
|
|
903
776
|
url: typing.Optional[str] = OMIT,
|
|
904
777
|
event_types: typing.Optional[typing.Sequence[EventType]] = OMIT,
|
|
905
778
|
disabled: typing.Optional[bool] = OMIT,
|
|
779
|
+
recover_since: typing.Optional[dt.datetime] = OMIT,
|
|
906
780
|
request_options: typing.Optional[RequestOptions] = None,
|
|
907
|
-
) ->
|
|
781
|
+
) -> WebhookSubscription:
|
|
908
782
|
"""
|
|
909
|
-
Update
|
|
783
|
+
Update an existing webhook subscription.
|
|
784
|
+
|
|
785
|
+
Use this endpoint to modify a subscription's configuration. You can:
|
|
910
786
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
787
|
+
- **Change the URL**: Update where events are delivered
|
|
788
|
+
- **Update event types**: Modify which events trigger notifications
|
|
789
|
+
- **Enable/disable**: Temporarily pause delivery without deleting the subscription
|
|
790
|
+
- **Recover messages**: When re-enabling, optionally recover missed messages
|
|
915
791
|
|
|
916
|
-
|
|
917
|
-
|
|
792
|
+
Only include the fields you want to change. Omitted fields will retain their
|
|
793
|
+
current values.
|
|
794
|
+
|
|
795
|
+
When re-enabling a subscription (`disabled: false`), you can optionally provide
|
|
796
|
+
`recover_since` to automatically retry all messages that were generated while
|
|
797
|
+
the subscription was disabled.
|
|
918
798
|
|
|
919
799
|
Parameters
|
|
920
800
|
----------
|
|
921
801
|
subscription_id : str
|
|
802
|
+
The unique identifier of the subscription to update (UUID).
|
|
922
803
|
|
|
923
804
|
url : typing.Optional[str]
|
|
805
|
+
New URL for webhook delivery. Must be a publicly accessible HTTPS endpoint.
|
|
924
806
|
|
|
925
807
|
event_types : typing.Optional[typing.Sequence[EventType]]
|
|
808
|
+
New list of event types to subscribe to. This replaces the existing list entirely.
|
|
926
809
|
|
|
927
810
|
disabled : typing.Optional[bool]
|
|
811
|
+
Set to `true` to pause delivery to this subscription, or `false` to resume. Disabled subscriptions will not receive events.
|
|
812
|
+
|
|
813
|
+
recover_since : typing.Optional[dt.datetime]
|
|
814
|
+
When re-enabling a subscription (`disabled: false`), optionally recover failed messages from this timestamp. Only applies when enabling.
|
|
928
815
|
|
|
929
816
|
request_options : typing.Optional[RequestOptions]
|
|
930
817
|
Request-specific configuration.
|
|
931
818
|
|
|
932
819
|
Returns
|
|
933
820
|
-------
|
|
934
|
-
|
|
935
|
-
|
|
821
|
+
WebhookSubscription
|
|
822
|
+
Updated subscription
|
|
936
823
|
|
|
937
824
|
Examples
|
|
938
825
|
--------
|
|
@@ -941,133 +828,28 @@ class AsyncEventsClient:
|
|
|
941
828
|
from airweave import AsyncAirweaveSDK
|
|
942
829
|
|
|
943
830
|
client = AsyncAirweaveSDK(
|
|
944
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
945
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
946
831
|
api_key="YOUR_API_KEY",
|
|
947
832
|
)
|
|
948
833
|
|
|
949
834
|
|
|
950
835
|
async def main() -> None:
|
|
951
836
|
await client.events.patch_subscription(
|
|
952
|
-
subscription_id="
|
|
837
|
+
subscription_id="550e8400-e29b-41d4-a716-446655440000",
|
|
953
838
|
)
|
|
954
839
|
|
|
955
840
|
|
|
956
841
|
asyncio.run(main())
|
|
957
842
|
"""
|
|
958
843
|
_response = await self._raw_client.patch_subscription(
|
|
959
|
-
subscription_id,
|
|
844
|
+
subscription_id,
|
|
845
|
+
url=url,
|
|
846
|
+
event_types=event_types,
|
|
847
|
+
disabled=disabled,
|
|
848
|
+
recover_since=recover_since,
|
|
849
|
+
request_options=request_options,
|
|
960
850
|
)
|
|
961
851
|
return _response.data
|
|
962
852
|
|
|
963
|
-
async def enable_subscription(
|
|
964
|
-
self,
|
|
965
|
-
subscription_id: str,
|
|
966
|
-
*,
|
|
967
|
-
request: typing.Optional[EnableEndpointRequest] = None,
|
|
968
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
969
|
-
) -> EndpointOut:
|
|
970
|
-
"""
|
|
971
|
-
Enable a disabled webhook subscription, optionally recovering failed messages.
|
|
972
|
-
|
|
973
|
-
Args:
|
|
974
|
-
subscription_id: The ID of the subscription to enable.
|
|
975
|
-
request: Optional request with recovery time range.
|
|
976
|
-
ctx: The API context containing organization info.
|
|
977
|
-
|
|
978
|
-
Returns:
|
|
979
|
-
The enabled subscription.
|
|
980
|
-
|
|
981
|
-
Parameters
|
|
982
|
-
----------
|
|
983
|
-
subscription_id : str
|
|
984
|
-
|
|
985
|
-
request : typing.Optional[EnableEndpointRequest]
|
|
986
|
-
|
|
987
|
-
request_options : typing.Optional[RequestOptions]
|
|
988
|
-
Request-specific configuration.
|
|
989
|
-
|
|
990
|
-
Returns
|
|
991
|
-
-------
|
|
992
|
-
EndpointOut
|
|
993
|
-
Successful Response
|
|
994
|
-
|
|
995
|
-
Examples
|
|
996
|
-
--------
|
|
997
|
-
import asyncio
|
|
998
|
-
|
|
999
|
-
from airweave import AsyncAirweaveSDK, EnableEndpointRequest
|
|
1000
|
-
|
|
1001
|
-
client = AsyncAirweaveSDK(
|
|
1002
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
1003
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
1004
|
-
api_key="YOUR_API_KEY",
|
|
1005
|
-
)
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
async def main() -> None:
|
|
1009
|
-
await client.events.enable_subscription(
|
|
1010
|
-
subscription_id="subscription_id",
|
|
1011
|
-
request=EnableEndpointRequest(),
|
|
1012
|
-
)
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
asyncio.run(main())
|
|
1016
|
-
"""
|
|
1017
|
-
_response = await self._raw_client.enable_subscription(
|
|
1018
|
-
subscription_id, request=request, request_options=request_options
|
|
1019
|
-
)
|
|
1020
|
-
return _response.data
|
|
1021
|
-
|
|
1022
|
-
async def get_subscription_secret(
|
|
1023
|
-
self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1024
|
-
) -> EndpointSecretOut:
|
|
1025
|
-
"""
|
|
1026
|
-
Get the signing secret for a webhook subscription.
|
|
1027
|
-
|
|
1028
|
-
Args:
|
|
1029
|
-
subscription_id: The ID of the subscription.
|
|
1030
|
-
ctx: The API context containing organization info.
|
|
1031
|
-
|
|
1032
|
-
Returns:
|
|
1033
|
-
The subscription's signing secret.
|
|
1034
|
-
|
|
1035
|
-
Parameters
|
|
1036
|
-
----------
|
|
1037
|
-
subscription_id : str
|
|
1038
|
-
|
|
1039
|
-
request_options : typing.Optional[RequestOptions]
|
|
1040
|
-
Request-specific configuration.
|
|
1041
|
-
|
|
1042
|
-
Returns
|
|
1043
|
-
-------
|
|
1044
|
-
EndpointSecretOut
|
|
1045
|
-
Successful Response
|
|
1046
|
-
|
|
1047
|
-
Examples
|
|
1048
|
-
--------
|
|
1049
|
-
import asyncio
|
|
1050
|
-
|
|
1051
|
-
from airweave import AsyncAirweaveSDK
|
|
1052
|
-
|
|
1053
|
-
client = AsyncAirweaveSDK(
|
|
1054
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
1055
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
1056
|
-
api_key="YOUR_API_KEY",
|
|
1057
|
-
)
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
async def main() -> None:
|
|
1061
|
-
await client.events.get_subscription_secret(
|
|
1062
|
-
subscription_id="subscription_id",
|
|
1063
|
-
)
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
asyncio.run(main())
|
|
1067
|
-
"""
|
|
1068
|
-
_response = await self._raw_client.get_subscription_secret(subscription_id, request_options=request_options)
|
|
1069
|
-
return _response.data
|
|
1070
|
-
|
|
1071
853
|
async def recover_failed_messages(
|
|
1072
854
|
self,
|
|
1073
855
|
subscription_id: str,
|
|
@@ -1075,37 +857,38 @@ class AsyncEventsClient:
|
|
|
1075
857
|
since: dt.datetime,
|
|
1076
858
|
until: typing.Optional[dt.datetime] = OMIT,
|
|
1077
859
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1078
|
-
) ->
|
|
860
|
+
) -> RecoveryTask:
|
|
1079
861
|
"""
|
|
1080
|
-
|
|
862
|
+
Retry failed message deliveries for a webhook subscription.
|
|
1081
863
|
|
|
1082
|
-
|
|
1083
|
-
time.
|
|
1084
|
-
failed while the endpoint was down.
|
|
864
|
+
Triggers a recovery process that replays all failed messages within the
|
|
865
|
+
specified time window. This is useful when:
|
|
1085
866
|
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
ctx: The API context containing organization info.
|
|
867
|
+
- Your endpoint was temporarily down and you want to catch up
|
|
868
|
+
- You've fixed a bug in your webhook handler
|
|
869
|
+
- You want to reprocess events after re-enabling a disabled subscription
|
|
1090
870
|
|
|
1091
|
-
|
|
1092
|
-
|
|
871
|
+
Messages are retried in chronological order. Successfully delivered messages
|
|
872
|
+
are skipped; only failed or pending messages are retried.
|
|
1093
873
|
|
|
1094
874
|
Parameters
|
|
1095
875
|
----------
|
|
1096
876
|
subscription_id : str
|
|
877
|
+
The unique identifier of the subscription to recover messages for (UUID).
|
|
1097
878
|
|
|
1098
879
|
since : dt.datetime
|
|
880
|
+
Start of the recovery time window (inclusive). All failed messages from this time onward will be retried.
|
|
1099
881
|
|
|
1100
882
|
until : typing.Optional[dt.datetime]
|
|
883
|
+
End of the recovery time window (exclusive). If not specified, recovers all failed messages up to now.
|
|
1101
884
|
|
|
1102
885
|
request_options : typing.Optional[RequestOptions]
|
|
1103
886
|
Request-specific configuration.
|
|
1104
887
|
|
|
1105
888
|
Returns
|
|
1106
889
|
-------
|
|
1107
|
-
|
|
1108
|
-
|
|
890
|
+
RecoveryTask
|
|
891
|
+
Recovery task information
|
|
1109
892
|
|
|
1110
893
|
Examples
|
|
1111
894
|
--------
|
|
@@ -1115,17 +898,15 @@ class AsyncEventsClient:
|
|
|
1115
898
|
from airweave import AsyncAirweaveSDK
|
|
1116
899
|
|
|
1117
900
|
client = AsyncAirweaveSDK(
|
|
1118
|
-
framework_name="YOUR_FRAMEWORK_NAME",
|
|
1119
|
-
framework_version="YOUR_FRAMEWORK_VERSION",
|
|
1120
901
|
api_key="YOUR_API_KEY",
|
|
1121
902
|
)
|
|
1122
903
|
|
|
1123
904
|
|
|
1124
905
|
async def main() -> None:
|
|
1125
906
|
await client.events.recover_failed_messages(
|
|
1126
|
-
subscription_id="
|
|
907
|
+
subscription_id="550e8400-e29b-41d4-a716-446655440000",
|
|
1127
908
|
since=datetime.datetime.fromisoformat(
|
|
1128
|
-
"2024-
|
|
909
|
+
"2024-03-14 00:00:00+00:00",
|
|
1129
910
|
),
|
|
1130
911
|
)
|
|
1131
912
|
|