Documentation
¶
Index ¶
- func ExtractHTML(msg *gmail.Message) string
- func ExtractPlainText(msg *gmail.Message) string
- type Client
- func (c *Client) ActiveAccountEmail(ctx context.Context) (string, error)
- func (c *Client) ApplyLabel(messageID, labelID string) error
- func (c *Client) ArchiveMessage(messageID string) error
- func (c *Client) CreateDraft(to, subject, body string, cc []string) (string, error)
- func (c *Client) CreateLabel(name string) (*gmail.Label, error)
- func (c *Client) CreateMessageFromRaw(rawMsg *gmail.Message) *Message
- func (c *Client) DeleteDraft(draftID string) error
- func (c *Client) DeleteLabel(labelID string) error
- func (c *Client) ExtractDate(msg *gmail.Message) time.Time
- func (c *Client) ExtractHeader(msg *gmail.Message, name string) string
- func (c *Client) ExtractLabels(msg *gmail.Message) []string
- func (c *Client) GetAttachment(messageID, attachmentID string) ([]byte, string, error)
- func (c *Client) GetDraft(draftID string) (*gmail.Draft, error)
- func (c *Client) GetMessage(id string) (*gmail.Message, error)
- func (c *Client) GetMessageMetadata(id string) (*gmail.Message, error)
- func (c *Client) GetMessageWithContent(id string) (*Message, error)
- func (c *Client) GetMessagesMetadataParallel(messageIDs []string, maxWorkers int) ([]*gmail.Message, error)
- func (c *Client) GetMessagesParallel(messageIDs []string, maxWorkers int) ([]*gmail.Message, error)
- func (c *Client) ListDrafts(maxResults int64) ([]*gmail.Draft, error)
- func (c *Client) ListLabels() ([]*gmail.Label, error)
- func (c *Client) ListMessages(maxResults int64) ([]*gmail.Message, error)
- func (c *Client) ListMessagesPage(maxResults int64, pageToken string) ([]*gmail.Message, string, error)
- func (c *Client) MarkAsRead(messageID string) error
- func (c *Client) MarkAsUnread(messageID string) error
- func (c *Client) RemoveLabel(messageID, labelID string) error
- func (c *Client) RenameLabel(labelID, newName string) (*gmail.Label, error)
- func (c *Client) ReplyMessage(originalMsgID, replyBody string, send bool, cc []string) (string, error)
- func (c *Client) SearchMessages(query string, maxResults int64) ([]*gmail.Message, error)
- func (c *Client) SearchMessagesPage(query string, maxResults int64, pageToken string) ([]*gmail.Message, string, error)
- func (c *Client) SendMessage(from, to, subject, body string, cc, bcc []string) (string, error)
- func (c *Client) SendRawMIME(raw string) (string, error)
- func (c *Client) TrashMessage(messageID string) error
- func (c *Client) UpdateDraft(draftID, to, subject, body string, cc []string) error
- type Message
- type MessageResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractHTML ¶
ExtractHTML extracts HTML content from a Gmail message
func ExtractPlainText ¶
ExtractPlainText extracts plain text content from a Gmail message
Types ¶
type Client ¶
Client wraps the gmail.Service and provides convenience methods
func (*Client) ActiveAccountEmail ¶
ActiveAccountEmail returns the authenticated user's email address. Uses Gmail Users.GetProfile("me"). The value is cached for subsequent calls.
func (*Client) ApplyLabel ¶
ApplyLabel applies a label to a message
func (*Client) ArchiveMessage ¶
ArchiveMessage archives a message
func (*Client) CreateDraft ¶
CreateDraft creates a new draft message
func (*Client) CreateLabel ¶
CreateLabel creates a new label
func (*Client) CreateMessageFromRaw ¶ added in v1.0.1
CreateMessageFromRaw creates a gmail.Message wrapper from a raw gmail API message This is used to convert preloader cached messages to the expected format without additional API calls
func (*Client) DeleteDraft ¶
DeleteDraft deletes a draft message
func (*Client) DeleteLabel ¶
DeleteLabel removes a label permanently
func (*Client) ExtractDate ¶
ExtractDate extracts the date from a message
func (*Client) ExtractHeader ¶
ExtractHeader extracts a header value from a message
func (*Client) ExtractLabels ¶
ExtractLabels extracts labels from a message
func (*Client) GetAttachment ¶
GetAttachment downloads an attachment
func (*Client) GetMessage ¶
GetMessage retrieves a specific message by ID
func (*Client) GetMessageMetadata ¶ added in v1.0.1
GetMessageMetadata retrieves only message metadata (headers, labels) for efficient list display This is significantly faster and uses less bandwidth than GetMessage() for list operations
func (*Client) GetMessageWithContent ¶
GetMessageWithContent retrieves a message and extracts its content
func (*Client) GetMessagesMetadataParallel ¶ added in v1.0.1
func (c *Client) GetMessagesMetadataParallel(messageIDs []string, maxWorkers int) ([]*gmail.Message, error)
GetMessagesMetadataParallel fetches multiple message metadata concurrently for efficient list display Uses format=metadata to reduce bandwidth and improve performance compared to GetMessagesParallel Returns results in the same order as input IDs, with nil for failed fetches
func (*Client) GetMessagesParallel ¶ added in v1.0.1
GetMessagesParallel fetches multiple messages concurrently using a worker pool Returns results in the same order as input IDs, with nil for failed fetches
func (*Client) ListDrafts ¶
ListDrafts returns draft messages with full message content
func (*Client) ListLabels ¶
ListLabels returns all labels
func (*Client) ListMessages ¶
ListMessages returns first page of inbox messages (backward-compatible)
func (*Client) ListMessagesPage ¶
func (c *Client) ListMessagesPage(maxResults int64, pageToken string) ([]*gmail.Message, string, error)
ListMessagesPage returns a page of inbox messages and the nextPageToken
func (*Client) MarkAsRead ¶
MarkAsRead marks a message as read
func (*Client) MarkAsUnread ¶
MarkAsUnread marks a message as unread
func (*Client) RemoveLabel ¶
RemoveLabel removes a label from a message
func (*Client) RenameLabel ¶
RenameLabel updates the name of an existing label
func (*Client) ReplyMessage ¶
func (c *Client) ReplyMessage(originalMsgID, replyBody string, send bool, cc []string) (string, error)
ReplyMessage creates a reply to an existing message
func (*Client) SearchMessages ¶
SearchMessages searches for messages using Gmail query syntax
func (*Client) SearchMessagesPage ¶
func (c *Client) SearchMessagesPage(query string, maxResults int64, pageToken string) ([]*gmail.Message, string, error)
SearchMessagesPage searches with Gmail query and supports pagination
func (*Client) SendMessage ¶
SendMessage sends a message
func (*Client) SendRawMIME ¶
SendRawMIME sends a fully-formed MIME message (raw content). Caller is responsible for providing correct headers, MIME-Version, boundaries, and payloads. The raw string will be base64url encoded as required by Gmail API.
func (*Client) TrashMessage ¶
TrashMessage moves a message to trash