Documentation
¶
Overview ¶
Package gmail provides a Gmail email provider for omnichat using the Gmail API.
Index ¶
- type Config
- type IncomingEmail
- type Provider
- func (p *Provider) Connect(ctx context.Context) error
- func (p *Provider) Disconnect(ctx context.Context) error
- func (p *Provider) Name() string
- func (p *Provider) OnEvent(handler provider.EventHandler)
- func (p *Provider) OnMessage(handler provider.MessageHandler)
- func (p *Provider) Send(ctx context.Context, chatID string, msg provider.OutgoingMessage) error
- func (p *Provider) SendEmail(ctx context.Context, to, subject, body string, html bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// CredentialsJSON is the Google OAuth credentials JSON (client_secret.json contents).
// This is the application credentials, not the user token.
CredentialsJSON []byte
// TokenFile is the path to store/load the OAuth token.
// If empty, defaults to ~/.agentcomms/gmail_token.json
TokenFile string
// FromAddress is the email address to send from.
// Use "me" to send from the authenticated user's address.
FromAddress string
// Scopes defines the OAuth scopes to request.
// If empty, defaults to gmail.GmailSendScope.
Scopes []string
// Logger is the logger instance.
Logger *slog.Logger
// ForceNewToken forces re-authentication even if a token exists.
ForceNewToken bool
}
Config configures the Gmail provider.
type IncomingEmail ¶
type IncomingEmail struct {
ID string
From string
To string
Subject string
Body string
BodyHTML string
Timestamp time.Time
ThreadID string
Labels []string
}
IncomingEmail represents an email received (for future Watch API support).
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the Provider interface for Gmail.
func (*Provider) Disconnect ¶
Disconnect closes the Gmail connection.
func (*Provider) OnEvent ¶
func (p *Provider) OnEvent(handler provider.EventHandler)
OnEvent registers an event handler.
func (*Provider) OnMessage ¶
func (p *Provider) OnMessage(handler provider.MessageHandler)
OnMessage registers a message handler. Note: Gmail inbound requires Watch API setup which is not yet implemented.
Click to show internal directories.
Click to hide internal directories.