Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: Sort methods on python resources consistently #1645

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 104 additions & 104 deletions python/svix/api/endpoint.py
Original file line number Diff line number Diff line change
@@ -102,6 +102,13 @@ async def update(
json_body=endpoint_update,
)

async def delete(self, app_id: str, endpoint_id: str) -> None:
return await v1_endpoint_delete.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
)

async def patch(
self, app_id: str, endpoint_id: str, endpoint_patch: EndpointPatch
) -> EndpointOut:
@@ -112,33 +119,31 @@ async def patch(
json_body=endpoint_patch,
)

async def delete(self, app_id: str, endpoint_id: str) -> None:
return await v1_endpoint_delete.request_asyncio(
async def get_headers(self, app_id: str, endpoint_id: str) -> EndpointHeadersOut:
return await v1_endpoint_get_headers.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
)

async def get_secret(self, app_id: str, endpoint_id: str) -> EndpointSecretOut:
return await v1_endpoint_get_secret.request_asyncio(
async def update_headers(
self, app_id: str, endpoint_id: str, endpoint_headers_in: EndpointHeadersIn
) -> None:
return await v1_endpoint_update_headers.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=endpoint_headers_in,
)

async def rotate_secret(
self,
app_id: str,
endpoint_id: str,
endpoint_secret_rotate_in: EndpointSecretRotateIn,
options: PostOptions = PostOptions(),
async def patch_headers(
self, app_id: str, endpoint_id: str, endpoint_headers_in: EndpointHeadersPatchIn
) -> None:
return await v1_endpoint_rotate_secret.request_asyncio(
return await v1_endpoint_patch_headers.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=endpoint_secret_rotate_in,
**options.to_dict(),
json_body=endpoint_headers_in,
)

async def recover(
@@ -156,60 +161,70 @@ async def recover(
**options.to_dict(),
)

async def get_headers(self, app_id: str, endpoint_id: str) -> EndpointHeadersOut:
return await v1_endpoint_get_headers.request_asyncio(
async def replay_missing(
self,
app_id: str,
endpoint_id: str,
replay_in: ReplayIn,
options: PostOptions = PostOptions(),
) -> ReplayOut:
return await v1_endpoint_replay_missing.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=replay_in,
**options.to_dict(),
)

async def update_headers(
self, app_id: str, endpoint_id: str, endpoint_headers_in: EndpointHeadersIn
) -> None:
return await v1_endpoint_update_headers.request_asyncio(
async def get_secret(self, app_id: str, endpoint_id: str) -> EndpointSecretOut:
return await v1_endpoint_get_secret.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=endpoint_headers_in,
)

async def patch_headers(
self, app_id: str, endpoint_id: str, endpoint_headers_in: EndpointHeadersPatchIn
async def rotate_secret(
self,
app_id: str,
endpoint_id: str,
endpoint_secret_rotate_in: EndpointSecretRotateIn,
options: PostOptions = PostOptions(),
) -> None:
return await v1_endpoint_patch_headers.request_asyncio(
return await v1_endpoint_rotate_secret.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=endpoint_headers_in,
json_body=endpoint_secret_rotate_in,
**options.to_dict(),
)

async def get_stats(
async def send_example(
self,
app_id: str,
endpoint_id: str,
options: EndpointStatsOptions = EndpointStatsOptions(),
) -> EndpointStats:
return await v1_endpoint_get_stats.request_asyncio(
event_example_in: EventExampleIn,
options: PostOptions = PostOptions(),
) -> MessageOut:
return await v1_endpoint_send_example.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
since=ensure_tz(options.since),
until=ensure_tz(options.until),
json_body=event_example_in,
**options.to_dict(),
)

async def replay_missing(
async def get_stats(
self,
app_id: str,
endpoint_id: str,
replay_in: ReplayIn,
options: PostOptions = PostOptions(),
) -> ReplayOut:
return await v1_endpoint_replay_missing.request_asyncio(
options: EndpointStatsOptions = EndpointStatsOptions(),
) -> EndpointStats:
return await v1_endpoint_get_stats.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=replay_in,
**options.to_dict(),
since=ensure_tz(options.since),
until=ensure_tz(options.until),
)

async def transformations_get(
@@ -232,21 +247,6 @@ async def transformation_partial_update(
json_body=endpoint_transformation_in,
)

async def send_example(
self,
app_id: str,
endpoint_id: str,
event_example_in: EventExampleIn,
options: PostOptions = PostOptions(),
) -> MessageOut:
return await v1_endpoint_send_example.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=event_example_in,
**options.to_dict(),
)


class Endpoint(ApiBase):
def list(
@@ -283,6 +283,13 @@ def update(
json_body=endpoint_update,
)

def delete(self, app_id: str, endpoint_id: str) -> None:
return v1_endpoint_delete.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
)

def patch(
self, app_id: str, endpoint_id: str, endpoint_patch: EndpointPatch
) -> EndpointOut:
@@ -293,33 +300,31 @@ def patch(
json_body=endpoint_patch,
)

def delete(self, app_id: str, endpoint_id: str) -> None:
return v1_endpoint_delete.request_sync(
def get_headers(self, app_id: str, endpoint_id: str) -> EndpointHeadersOut:
return v1_endpoint_get_headers.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
)

def get_secret(self, app_id: str, endpoint_id: str) -> EndpointSecretOut:
return v1_endpoint_get_secret.request_sync(
def update_headers(
self, app_id: str, endpoint_id: str, endpoint_headers_in: EndpointHeadersIn
) -> None:
return v1_endpoint_update_headers.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=endpoint_headers_in,
)

def rotate_secret(
self,
app_id: str,
endpoint_id: str,
endpoint_secret_rotate_in: EndpointSecretRotateIn,
options: PostOptions = PostOptions(),
def patch_headers(
self, app_id: str, endpoint_id: str, endpoint_headers_in: EndpointHeadersPatchIn
) -> None:
return v1_endpoint_rotate_secret.request_sync(
return v1_endpoint_patch_headers.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=endpoint_secret_rotate_in,
**options.to_dict(),
json_body=endpoint_headers_in,
)

def recover(
@@ -337,60 +342,70 @@ def recover(
**options.to_dict(),
)

def get_headers(self, app_id: str, endpoint_id: str) -> EndpointHeadersOut:
return v1_endpoint_get_headers.request_sync(
def replay_missing(
self,
app_id: str,
endpoint_id: str,
replay_in: ReplayIn,
options: PostOptions = PostOptions(),
) -> ReplayOut:
return v1_endpoint_replay_missing.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=replay_in,
**options.to_dict(),
)

def update_headers(
self, app_id: str, endpoint_id: str, endpoint_headers_in: EndpointHeadersIn
) -> None:
return v1_endpoint_update_headers.request_sync(
def get_secret(self, app_id: str, endpoint_id: str) -> EndpointSecretOut:
return v1_endpoint_get_secret.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=endpoint_headers_in,
)

def patch_headers(
self, app_id: str, endpoint_id: str, endpoint_headers_in: EndpointHeadersPatchIn
def rotate_secret(
self,
app_id: str,
endpoint_id: str,
endpoint_secret_rotate_in: EndpointSecretRotateIn,
options: PostOptions = PostOptions(),
) -> None:
return v1_endpoint_patch_headers.request_sync(
return v1_endpoint_rotate_secret.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=endpoint_headers_in,
json_body=endpoint_secret_rotate_in,
**options.to_dict(),
)

def get_stats(
def send_example(
self,
app_id: str,
endpoint_id: str,
options: EndpointStatsOptions = EndpointStatsOptions(),
) -> EndpointStats:
return v1_endpoint_get_stats.request_sync(
event_example_in: EventExampleIn,
options: PostOptions = PostOptions(),
) -> MessageOut:
return v1_endpoint_send_example.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
since=ensure_tz(options.since),
until=ensure_tz(options.until),
json_body=event_example_in,
**options.to_dict(),
)

def replay_missing(
def get_stats(
self,
app_id: str,
endpoint_id: str,
replay_in: ReplayIn,
options: PostOptions = PostOptions(),
) -> ReplayOut:
return v1_endpoint_replay_missing.request_sync(
options: EndpointStatsOptions = EndpointStatsOptions(),
) -> EndpointStats:
return v1_endpoint_get_stats.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=replay_in,
**options.to_dict(),
since=ensure_tz(options.since),
until=ensure_tz(options.until),
)

def transformations_get(
@@ -412,18 +427,3 @@ def transformation_partial_update(
endpoint_id=endpoint_id,
json_body=endpoint_transformation_in,
)

def send_example(
self,
app_id: str,
endpoint_id: str,
event_example_in: EventExampleIn,
options: PostOptions = PostOptions(),
) -> MessageOut:
return v1_endpoint_send_example.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
json_body=event_example_in,
**options.to_dict(),
)
68 changes: 34 additions & 34 deletions python/svix/api/event_type.py
Original file line number Diff line number Diff line change
@@ -51,6 +51,17 @@ async def create(
**options.to_dict(),
)

async def import_openapi(
self,
event_type_import_openapi_in: EventTypeImportOpenApiIn,
options: PostOptions = PostOptions(),
) -> EventTypeImportOpenApiOut:
return await v1_event_type_import_openapi.request_asyncio(
client=self._client,
json_body=event_type_import_openapi_in,
**options.to_dict(),
)

async def get(self, event_type_name: str) -> EventTypeOut:
return await v1_event_type_get.request_asyncio(
client=self._client,
@@ -66,30 +77,19 @@ async def update(
json_body=event_type_update,
)

async def patch(
self, event_type_name: str, event_type_patch: EventTypePatch
) -> EventTypeOut:
return await v1_event_type_patch.request_asyncio(
client=self._client,
event_type_name=event_type_name,
json_body=event_type_patch,
)

async def delete(self, event_type_name: str) -> None:
return await v1_event_type_delete.request_asyncio(
client=self._client,
event_type_name=event_type_name,
)

async def import_openapi(
self,
event_type_import_openapi_in: EventTypeImportOpenApiIn,
options: PostOptions = PostOptions(),
) -> EventTypeImportOpenApiOut:
return await v1_event_type_import_openapi.request_asyncio(
async def patch(
self, event_type_name: str, event_type_patch: EventTypePatch
) -> EventTypeOut:
return await v1_event_type_patch.request_asyncio(
client=self._client,
json_body=event_type_import_openapi_in,
**options.to_dict(),
event_type_name=event_type_name,
json_body=event_type_patch,
)


@@ -111,6 +111,17 @@ def create(
**options.to_dict(),
)

def import_openapi(
self,
event_type_import_openapi_in: EventTypeImportOpenApiIn,
options: PostOptions = PostOptions(),
) -> EventTypeImportOpenApiOut:
return v1_event_type_import_openapi.request_sync(
client=self._client,
json_body=event_type_import_openapi_in,
**options.to_dict(),
)

def get(self, event_type_name: str) -> EventTypeOut:
return v1_event_type_get.request_sync(
client=self._client,
@@ -126,28 +137,17 @@ def update(
json_body=event_type_update,
)

def patch(
self, event_type_name: str, event_type_patch: EventTypePatch
) -> EventTypeOut:
return v1_event_type_patch.request_sync(
client=self._client,
event_type_name=event_type_name,
json_body=event_type_patch,
)

def delete(self, event_type_name: str) -> None:
return v1_event_type_delete.request_sync(
client=self._client,
event_type_name=event_type_name,
)

def import_openapi(
self,
event_type_import_openapi_in: EventTypeImportOpenApiIn,
options: PostOptions = PostOptions(),
) -> EventTypeImportOpenApiOut:
return v1_event_type_import_openapi.request_sync(
def patch(
self, event_type_name: str, event_type_patch: EventTypePatch
) -> EventTypeOut:
return v1_event_type_patch.request_sync(
client=self._client,
json_body=event_type_import_openapi_in,
**options.to_dict(),
event_type_name=event_type_name,
json_body=event_type_patch,
)
132 changes: 66 additions & 66 deletions python/svix/api/message_attempt.py
Original file line number Diff line number Diff line change
@@ -53,6 +53,19 @@ def to_dict(self) -> t.Dict[str, t.Any]:


class MessageAttemptAsync(ApiBase):
async def list_by_endpoint(
self,
app_id: str,
endpoint_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseMessageAttemptOut:
return await v1_message_attempt_list_by_endpoint.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
**options.to_dict(),
)

async def list_by_msg(
self,
app_id: str,
@@ -63,13 +76,13 @@ async def list_by_msg(
client=self._client, app_id=app_id, msg_id=msg_id, **options.to_dict()
)

async def list_by_endpoint(
async def list_attempted_messages(
self,
app_id: str,
endpoint_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseMessageAttemptOut:
return await v1_message_attempt_list_by_endpoint.request_asyncio(
) -> ListResponseEndpointMessageOut:
return await v1_message_attempt_list_attempted_messages.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
@@ -84,44 +97,44 @@ async def get(self, app_id: str, msg_id: str, attempt_id: str) -> MessageAttempt
attempt_id=attempt_id,
)

async def resend(
async def expunge_content(
self,
app_id: str,
msg_id: str,
endpoint_id: str,
options: PostOptions = PostOptions(),
attempt_id: str,
) -> None:
return await v1_message_attempt_resend.request_asyncio(
return await v1_message_attempt_expunge_content.request_asyncio(
client=self._client,
app_id=app_id,
msg_id=msg_id,
endpoint_id=endpoint_id,
**options.to_dict(),
attempt_id=attempt_id,
)

async def list_attempted_messages(
async def list_attempted_destinations(
self,
app_id: str,
endpoint_id: str,
msg_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseEndpointMessageOut:
return await v1_message_attempt_list_attempted_messages.request_asyncio(
) -> ListResponseMessageEndpointOut:
return await v1_message_attempt_list_attempted_destinations.request_asyncio(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
msg_id=msg_id,
**options.to_dict(),
)

async def list_attempted_destinations(
async def resend(
self,
app_id: str,
msg_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseMessageEndpointOut:
return await v1_message_attempt_list_attempted_destinations.request_asyncio(
endpoint_id: str,
options: PostOptions = PostOptions(),
) -> None:
return await v1_message_attempt_resend.request_asyncio(
client=self._client,
app_id=app_id,
msg_id=msg_id,
endpoint_id=endpoint_id,
**options.to_dict(),
)

@@ -143,29 +156,20 @@ async def list_attempts_for_endpoint(
**options.to_dict(),
)

async def expunge_content(
self,
app_id: str,
msg_id: str,
attempt_id: str,
) -> None:
return await v1_message_attempt_expunge_content.request_asyncio(
client=self._client,
app_id=app_id,
msg_id=msg_id,
attempt_id=attempt_id,
)


class MessageAttempt(ApiBase):
@deprecated(reason="use list_by_msg or list_by_endpoint instead")
def list(
def list_by_endpoint(
self,
app_id: str,
msg_id: str,
endpoint_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseMessageAttemptOut:
return self.list_by_msg(app_id=app_id, msg_id=msg_id, options=options)
return v1_message_attempt_list_by_endpoint.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
**options.to_dict(),
)

def list_by_msg(
self,
@@ -177,13 +181,13 @@ def list_by_msg(
client=self._client, app_id=app_id, msg_id=msg_id, **options.to_dict()
)

def list_by_endpoint(
def list_attempted_messages(
self,
app_id: str,
endpoint_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseMessageAttemptOut:
return v1_message_attempt_list_by_endpoint.request_sync(
) -> ListResponseEndpointMessageOut:
return v1_message_attempt_list_attempted_messages.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
@@ -198,47 +202,56 @@ def get(self, app_id: str, msg_id: str, attempt_id: str) -> MessageAttemptOut:
attempt_id=attempt_id,
)

def resend(
def expunge_content(
self,
app_id: str,
msg_id: str,
endpoint_id: str,
options: PostOptions = PostOptions(),
attempt_id: str,
) -> None:
return v1_message_attempt_resend.request_sync(
return v1_message_attempt_expunge_content.request_sync(
client=self._client,
app_id=app_id,
msg_id=msg_id,
endpoint_id=endpoint_id,
**options.to_dict(),
attempt_id=attempt_id,
)

def list_attempted_messages(
def list_attempted_destinations(
self,
app_id: str,
endpoint_id: str,
msg_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseEndpointMessageOut:
return v1_message_attempt_list_attempted_messages.request_sync(
) -> ListResponseMessageEndpointOut:
return v1_message_attempt_list_attempted_destinations.request_sync(
client=self._client,
app_id=app_id,
endpoint_id=endpoint_id,
msg_id=msg_id,
**options.to_dict(),
)

def list_attempted_destinations(
def resend(
self,
app_id: str,
msg_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseMessageEndpointOut:
return v1_message_attempt_list_attempted_destinations.request_sync(
endpoint_id: str,
options: PostOptions = PostOptions(),
) -> None:
return v1_message_attempt_resend.request_sync(
client=self._client,
app_id=app_id,
msg_id=msg_id,
endpoint_id=endpoint_id,
**options.to_dict(),
)

@deprecated(reason="use list_by_msg or list_by_endpoint instead")
def list(
self,
app_id: str,
msg_id: str,
options: MessageAttemptListOptions = MessageAttemptListOptions(),
) -> ListResponseMessageAttemptOut:
return self.list_by_msg(app_id=app_id, msg_id=msg_id, options=options)

@deprecated(
reason="use list_by_msg instead, passing the endpoint id through options"
)
@@ -256,16 +269,3 @@ def list_attempts_for_endpoint(
endpoint_id=endpoint_id,
**options.to_dict(),
)

def expunge_content(
self,
app_id: str,
msg_id: str,
attempt_id: str,
) -> None:
return v1_message_attempt_expunge_content.request_sync(
client=self._client,
app_id=app_id,
msg_id=msg_id,
attempt_id=attempt_id,
)