gmail
gmail
¶
GmailChannel — native Gmail API adapter using OAuth2.
Classes¶
GmailChannel
¶
GmailChannel(
credentials_path: str = "",
*,
token_path: str = "",
user_id: str = "me",
poll_interval: int = 30,
bus: Optional[EventBus] = None,
)
Bases: BaseChannel
Native Gmail channel adapter using the Gmail API with OAuth2.
| PARAMETER | DESCRIPTION |
|---|---|
credentials_path
|
Path to the OAuth2
TYPE:
|
token_path
|
Path to the stored OAuth2 token file.
Falls back to
TYPE:
|
user_id
|
Gmail user ID (default
TYPE:
|
poll_interval
|
Seconds between inbox polls (default 30).
TYPE:
|
bus
|
Optional event bus for publishing channel events.
TYPE:
|
Source code in src/diapason/channels/gmail.py
Methods:¶
connect
¶
Load OAuth2 credentials and build the Gmail API service.
Source code in src/diapason/channels/gmail.py
disconnect
¶
Stop the polling thread and clear the service.
Source code in src/diapason/channels/gmail.py
send
¶
send(
channel: str,
content: str,
*,
conversation_id: str = "",
metadata: Dict[str, Any] | None = None,
) -> bool
Send an email via the Gmail API.
channel is the recipient email address.
Source code in src/diapason/channels/gmail.py
status
¶
status() -> ChannelStatus