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
Show file tree
Hide file tree
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
Expand Up @@ -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:
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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:
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(),
)
Loading