Skip to content

Commit b0af708

Browse files
committed
python: Add operational webhook endpoint API
1 parent f5ae0b2 commit b0af708

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed

python/svix/api.py

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@
4646
v1_endpoint_update,
4747
v1_endpoint_update_headers,
4848
)
49+
from .internal.openapi_client.api.webhook_endpoint import (
50+
create_operational_webhook_endpoint,
51+
delete_operational_webhook_endpoint,
52+
get_operational_webhook_endpoint,
53+
get_operational_webhook_endpoint_secret,
54+
list_operational_webhook_endpoints,
55+
rotate_operational_webhook_endpoint_secret,
56+
update_operational_webhook_endpoint,
57+
)
4958
from .internal.openapi_client.api.event_type import (
5059
v1_event_type_create,
5160
v1_event_type_delete,
@@ -109,6 +118,21 @@
109118
from .internal.openapi_client.models.endpoint_secret_rotate_in import (
110119
EndpointSecretRotateIn,
111120
)
121+
from .internal.openapi_client.models.operational_webhook_endpoint_in import (
122+
OperationalWebhookEndpointIn,
123+
)
124+
from .internal.openapi_client.models.operational_webhook_endpoint_out import (
125+
OperationalWebhookEndpointOut,
126+
)
127+
from .internal.openapi_client.models.operational_webhook_endpoint_secret_in import (
128+
OperationalWebhookEndpointSecretIn,
129+
)
130+
from .internal.openapi_client.models.operational_webhook_endpoint_secret_out import (
131+
OperationalWebhookEndpointSecretOut,
132+
)
133+
from .internal.openapi_client.models.operational_webhook_endpoint_update import (
134+
OperationalWebhookEndpointUpdate,
135+
)
112136
from .internal.openapi_client.models.endpoint_stats import EndpointStats
113137
from .internal.openapi_client.models.endpoint_transformation_in import (
114138
EndpointTransformationIn,
@@ -144,6 +168,9 @@
144168
from .internal.openapi_client.models.list_response_endpoint_out import (
145169
ListResponseEndpointOut,
146170
)
171+
from .internal.openapi_client.models.list_response_operational_webhook_endpoint_out import (
172+
ListResponseOperationalWebhookEndpointOut,
173+
)
147174
from .internal.openapi_client.models.list_response_event_type_out import (
148175
ListResponseEventTypeOut,
149176
)
@@ -267,6 +294,11 @@ class EndpointStatsOptions:
267294
until: t.Optional[datetime] = None
268295

269296

297+
@dataclass
298+
class OperationalWebhookEndpointListOptions(ListOptions):
299+
order: t.Optional[Ordering] = None
300+
301+
270302
@dataclass
271303
class IntegrationListOptions(ListOptions):
272304
pass
@@ -1399,6 +1431,128 @@ def aggregate_event_types(self, task_id: str) -> AggregateEventTypesOut:
13991431
return v1_statistics_aggregate_event_types.request_sync(client=self._client)
14001432

14011433

1434+
class OperationalWebhookEndpointAsync(ApiBase):
1435+
async def list(
1436+
self,
1437+
options: OperationalWebhookEndpointListOptions = OperationalWebhookEndpointListOptions(),
1438+
) -> ListResponseOperationalWebhookEndpointOut:
1439+
return await list_operational_webhook_endpoints.request_asyncio(
1440+
client=self._client,
1441+
**options.to_dict(),
1442+
)
1443+
1444+
async def create(
1445+
self,
1446+
endpoint_in: OperationalWebhookEndpointIn,
1447+
options: PostOptions = PostOptions(),
1448+
) -> OperationalWebhookEndpointOut:
1449+
return await create_operational_webhook_endpoint.request_asyncio(
1450+
client=self._client,
1451+
json_body=endpoint_in,
1452+
**options.to_dict(),
1453+
)
1454+
1455+
async def get(self, endpoint_id: str) -> OperationalWebhookEndpointOut:
1456+
return await get_operational_webhook_endpoint.request_asyncio(
1457+
client=self._client, endpoint_id=endpoint_id
1458+
)
1459+
1460+
async def update(
1461+
self, endpoint_id: str, endpoint_update: OperationalWebhookEndpointUpdate
1462+
) -> OperationalWebhookEndpointOut:
1463+
return await update_operational_webhook_endpoint.request_asyncio(
1464+
client=self._client,
1465+
endpoint_id=endpoint_id,
1466+
json_body=endpoint_update,
1467+
)
1468+
1469+
async def delete(self, endpoint_id: str) -> None:
1470+
return await delete_operational_webhook_endpoint.request_asyncio(
1471+
client=self._client,
1472+
endpoint_id=endpoint_id,
1473+
)
1474+
1475+
async def get_secret(self, endpoint_id: str) -> OperationalWebhookEndpointSecretOut:
1476+
return await get_operational_webhook_endpoint_secret.request_asyncio(
1477+
client=self._client,
1478+
endpoint_id=endpoint_id,
1479+
)
1480+
1481+
async def rotate_secret(
1482+
self,
1483+
endpoint_id: str,
1484+
endpoint_secret_rotate_in: OperationalWebhookEndpointSecretIn,
1485+
options: PostOptions = PostOptions(),
1486+
) -> None:
1487+
return await rotate_operational_webhook_endpoint_secret.request_asyncio(
1488+
client=self._client,
1489+
endpoint_id=endpoint_id,
1490+
json_body=endpoint_secret_rotate_in,
1491+
**options.to_dict(),
1492+
)
1493+
1494+
1495+
class OperationalWebhookEndpoint(ApiBase):
1496+
def list(
1497+
self,
1498+
options: OperationalWebhookEndpointListOptions = OperationalWebhookEndpointListOptions(),
1499+
) -> ListResponseOperationalWebhookEndpointOut:
1500+
return list_operational_webhook_endpoints.request_sync(
1501+
client=self._client,
1502+
**options.to_dict(),
1503+
)
1504+
1505+
def create(
1506+
self,
1507+
endpoint_in: OperationalWebhookEndpointIn,
1508+
options: PostOptions = PostOptions(),
1509+
) -> OperationalWebhookEndpointOut:
1510+
return create_operational_webhook_endpoint.request_sync(
1511+
client=self._client,
1512+
json_body=endpoint_in,
1513+
**options.to_dict(),
1514+
)
1515+
1516+
def get(self, endpoint_id: str) -> OperationalWebhookEndpointOut:
1517+
return get_operational_webhook_endpoint.request_sync(
1518+
client=self._client, endpoint_id=endpoint_id
1519+
)
1520+
1521+
def update(
1522+
self, endpoint_id: str, endpoint_update: OperationalWebhookEndpointUpdate
1523+
) -> OperationalWebhookEndpointOut:
1524+
return update_operational_webhook_endpoint.request_sync(
1525+
client=self._client,
1526+
endpoint_id=endpoint_id,
1527+
json_body=endpoint_update,
1528+
)
1529+
1530+
def delete(self, endpoint_id: str) -> None:
1531+
return delete_operational_webhook_endpoint.request_sync(
1532+
client=self._client,
1533+
endpoint_id=endpoint_id,
1534+
)
1535+
1536+
def get_secret(self, endpoint_id: str) -> OperationalWebhookEndpointSecretOut:
1537+
return get_operational_webhook_endpoint_secret.request_sync(
1538+
client=self._client,
1539+
endpoint_id=endpoint_id,
1540+
)
1541+
1542+
def rotate_secret(
1543+
self,
1544+
endpoint_id: str,
1545+
endpoint_secret_rotate_in: OperationalWebhookEndpointSecretIn,
1546+
options: PostOptions = PostOptions(),
1547+
) -> None:
1548+
return rotate_operational_webhook_endpoint_secret.request_sync(
1549+
client=self._client,
1550+
endpoint_id=endpoint_id,
1551+
json_body=endpoint_secret_rotate_in,
1552+
**options.to_dict(),
1553+
)
1554+
1555+
14021556
class ClientBase:
14031557
_client: AuthenticatedClient
14041558

@@ -1464,6 +1618,10 @@ def message_attempt(self) -> MessageAttemptAsync:
14641618
def statistics(self) -> StatisticsAsync:
14651619
return StatisticsAsync(self._client)
14661620

1621+
@property
1622+
def operational_webhook_endpoint(self) -> OperationalWebhookEndpointAsync:
1623+
return OperationalWebhookEndpointAsync(self._client)
1624+
14671625

14681626
class Svix(ClientBase):
14691627
@property
@@ -1498,6 +1656,10 @@ def message_attempt(self) -> MessageAttempt:
14981656
def statistics(self) -> Statistics:
14991657
return Statistics(self._client)
15001658

1659+
@property
1660+
def operational_webhook_endpoint(self) -> OperationalWebhookEndpointAsync:
1661+
return OperationalWebhookEndpointAsync(self._client)
1662+
15011663

15021664
__all__ = [
15031665
"ApplicationIn",

0 commit comments

Comments
 (0)