Skip to content
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
56 changes: 28 additions & 28 deletions src/lettermint/endpoints/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def reschedule(
),
)

def cancel(self, message_id: str) -> lm_types.RescheduleMessageResponse:
def cancel(self, message_id: str) -> lm_types.CancelScheduledMessageResponse:
return cast(
lm_types.RescheduleMessageResponse,
lm_types.CancelScheduledMessageResponse,
self._client.post(
self._path("/messages/{messageId}/cancel", messageId=message_id), data={}
),
Expand Down Expand Up @@ -364,32 +364,6 @@ async def retrieve(
),
)

async def reschedule(
self, message_id: str, data: lm_types.RescheduleMessageRequest
) -> lm_types.RescheduleMessageResponse:
return cast(
lm_types.RescheduleMessageResponse,
await self._client.patch(
self._path("/messages/{messageId}", messageId=message_id), data=data
),
)

async def cancel(self, message_id: str) -> lm_types.RescheduleMessageResponse:
return cast(
lm_types.RescheduleMessageResponse,
await self._client.post(
self._path("/messages/{messageId}/cancel", messageId=message_id), data={}
),
)

async def process(self, message_id: str) -> lm_types.ProcessInboundMessageResponse:
return cast(
lm_types.ProcessInboundMessageResponse,
await self._client.post(
self._path("/messages/{messageId}/process", messageId=message_id), data={}
),
)

async def delete(self, domain_id: str) -> lm_types.DomainDestroyResponse:
return cast(
lm_types.DomainDestroyResponse,
Expand Down Expand Up @@ -446,6 +420,32 @@ async def retrieve(
),
)

async def reschedule(
self, message_id: str, data: lm_types.RescheduleMessageRequest
) -> lm_types.RescheduleMessageResponse:
return cast(
lm_types.RescheduleMessageResponse,
await self._client.patch(
self._path("/messages/{messageId}", messageId=message_id), data=data
),
)

async def cancel(self, message_id: str) -> lm_types.CancelScheduledMessageResponse:
return cast(
lm_types.CancelScheduledMessageResponse,
await self._client.post(
self._path("/messages/{messageId}/cancel", messageId=message_id), data={}
),
)

async def process(self, message_id: str) -> lm_types.ProcessInboundMessageResponse:
return cast(
lm_types.ProcessInboundMessageResponse,
await self._client.post(
self._path("/messages/{messageId}/process", messageId=message_id), data={}
),
)

async def events(
self, message_id: str, query: Query | None = None
) -> lm_types.MessageEventsResponse:
Expand Down
18 changes: 17 additions & 1 deletion src/lettermint/endpoints/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
from typing_extensions import Self

from ..message_tag import MessageTag, normalize_message_tags
from ..types import SendBatchEmailResponse, SendBatchMailRequest, SendEmailResponse, TlsPolicy
from ..types import (
SandboxResult,
SendBatchEmailResponse,
SendBatchMailRequest,
SendEmailResponse,
TlsPolicy,
)
from .endpoint import AsyncEndpoint, Endpoint

if TYPE_CHECKING:
Expand Down Expand Up @@ -299,6 +305,11 @@ def tags(self, tags: list[MessageTag | dict[str, str]]) -> Self:
self._payload["tags"] = [tag.to_dict() for tag in normalized]
return self

def sandbox_result(self, result: SandboxResult) -> Self:
"""Select the simulated result for a Sandbox project."""
self._payload["sandbox_result"] = result
return self

def send(self) -> SendEmailResponse:
"""Send the composed email.

Expand Down Expand Up @@ -600,6 +611,11 @@ def tags(self, tags: list[MessageTag | dict[str, str]]) -> Self:
self._payload["tags"] = [tag.to_dict() for tag in normalized]
return self

def sandbox_result(self, result: SandboxResult) -> Self:
"""Select the simulated result for a Sandbox project."""
self._payload["sandbox_result"] = result
return self

def send(self) -> Coroutine[Any, Any, SendEmailResponse]:
"""Send the composed email asynchronously.

Expand Down
Loading
Loading