Documentation
¶
Overview ¶
Package mail implements the gro mail command and subcommands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ClientFactory = func(ctx context.Context) (MailClient, error) { return gmail.NewClient(ctx) }
ClientFactory is the function used to create Gmail clients. Override in tests to inject mocks.
Functions ¶
func NewCommand ¶
NewCommand returns the mail parent command with subcommands
func SanitizeFilename ¶ added in v1.0.19
SanitizeFilename sanitizes a filename for display, removing potentially dangerous characters while preserving readability.
func SanitizeOutput ¶ added in v1.0.19
SanitizeOutput removes ANSI escape sequences and dangerous control characters from a string to prevent terminal injection attacks. Safe whitespace characters (tab, newline, carriage return) are preserved.
Types ¶
type Label ¶
type Label struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
MessagesTotal int64 `json:"messagesTotal,omitempty"`
MessagesUnread int64 `json:"messagesUnread,omitempty"`
}
Label represents a Gmail label for output
type MailClient ¶ added in v1.0.35
type MailClient interface {
GetMessage(ctx context.Context, messageID string, includeBody bool) (*gmail.Message, error)
SearchMessages(ctx context.Context, query string, maxResults int64) ([]*gmail.Message, int, error)
SearchMessageIDs(ctx context.Context, query string, maxResults int64) ([]string, error)
GetThread(ctx context.Context, id string) ([]*gmail.Message, error)
FetchLabels(ctx context.Context) error
GetLabelName(labelID string) string
GetLabelID(ctx context.Context, name string) (string, error)
GetLabels() []*gmailv1.Label
ModifyMessages(ctx context.Context, ids []string, addLabels, removeLabels []string) error
GetAttachments(ctx context.Context, messageID string) ([]*gmail.Attachment, error)
DownloadAttachment(ctx context.Context, messageID string, attachmentID string) ([]byte, error)
DownloadInlineAttachment(ctx context.Context, messageID string, partID string) ([]byte, error)
GetProfile(ctx context.Context) (*gmail.Profile, error)
}
MailClient defines the interface for Gmail client operations used by mail commands.
Click to show internal directories.
Click to hide internal directories.