gsmgmail

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package gsmgmail implements the Gmail APIs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessWindowIsValid

func AccessWindowIsValid(accessWindow string) bool

AccessWindowIsValid checks if the given AccessWindow is valid see: https://developers.google.com/gmail/api/reference/rest/v1/PopSettings#accesswindow

func BatchDeleteMessages

func BatchDeleteMessages(userID string, ids []string) (bool, error)

BatchDeleteMessages deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.

func BatchModifyMessages

func BatchModifyMessages(userID string, ids, addLabelIds, removeLabelIds []string) (bool, error)

BatchModifyMessages modifies the labels on the specified messages.

func ColorIsValid

func ColorIsValid(color string) bool

ColorIsValid checks if the given Color is valid see: https://developers.google.com/gmail/api/reference/rest/v1/users.labels#MessageListVisibility

func CreateDelegate

func CreateDelegate(userID, fields string, delegate *gmail.Delegate) (*gmail.Delegate, error)

CreateDelegate adds a delegate with its verification status set directly to accepted, without sending any verification email. The delegate user must be a member of the same Workspace organization as the delegator user. Gmail imposes limitations on the number of delegates and delegators each user in a Workspace organization can have. These limits depend on your organization, but in general each user can have up to 25 delegates and up to 10 delegators. Note that a delegate user must be referred to by their primary email address, and not an email alias. Also note that when a new delegate is created, there may be up to a one minute delay before the new delegate is available for use. This method is only available to service account clients that have been delegated domain-wide authority.

func CreateDraft

func CreateDraft(userID, fields string, draft *gmail.Draft, media ...io.Reader) (*gmail.Draft, error)

CreateDraft creates a new draft with the DRAFT label.

func CreateFilter

func CreateFilter(userID, fields string, settingsfilter *gmail.Filter) (*gmail.Filter, error)

CreateFilter creates a filter.

func CreateForwardingAddress

func CreateForwardingAddress(userID, fields string, forwardingAddress *gmail.ForwardingAddress) (*gmail.ForwardingAddress, error)

CreateForwardingAddress creates a forwarding address. If ownership verification is required, a message will be sent to the recipient and the resource's verification status will be set to pending; otherwise, the resource will be created with verification status set to accepted.

func CreateLabel

func CreateLabel(userID, fields string, label *gmail.Label) (*gmail.Label, error)

CreateLabel creates a new label.

func CreateSendAs

func CreateSendAs(userID, fields string, sendAs *gmail.SendAs) (*gmail.SendAs, error)

CreateSendAs creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail will attempt to connect to the SMTP service to validate the configuration before creating the alias. If ownership verification is required for the alias, a message will be sent to the email address and the resource's verification status will be set to pending; otherwise, the resource will be created with verification status set to accepted. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias.

func DeleteDelegate

func DeleteDelegate(userID, delegateEmail string) (bool, error)

DeleteDelegate removes the specified delegate (which can be of any verification status), and revokes any verification that may have been required for using it. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.

func DeleteDraft

func DeleteDraft(userID, id string) (bool, error)

DeleteDraft immediately and permanently deletes the specified draft. Does not simply trash it.

func DeleteFilter

func DeleteFilter(userID, id string) (bool, error)

DeleteFilter deletes a filter.

func DeleteForwardingAddress

func DeleteForwardingAddress(userID, forwardingEmail string) (bool, error)

DeleteForwardingAddress deletes the specified forwarding address and revokes any verification that may have been required.

func DeleteLabel

func DeleteLabel(userID, id string) (bool, error)

DeleteLabel immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.

func DeleteMessage

func DeleteMessage(userID, id string) (bool, error)

DeleteMessage immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.

func DeleteSendAs

func DeleteSendAs(userID, sendAsEmail string) (bool, error)

DeleteSendAs deletes the specified send-as alias. Revokes any verification that may have been required for using it.

func DeleteSmimeInfo

func DeleteSmimeInfo(userID, sendAsEmail, id string) (bool, error)

DeleteSmimeInfo deletes the specified S/MIME config for the specified send-as alias.

func DeleteThread

func DeleteThread(userID, id string) (bool, error)

DeleteThread Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer TrashThread instead.

func DispositionIsValid

func DispositionIsValid(disposition string) bool

DispositionIsValid checks if the given Disposition is valid see: https://developers.google.com/gmail/api/reference/rest/v1/AutoForwarding#disposition

func ExpungeBehaviourIsValid

func ExpungeBehaviourIsValid(expungebehaviour string) bool

ExpungeBehaviourIsValid checks if the given ExpungeBehaviour is valid see: https://developers.google.com/gmail/api/reference/rest/v1/ImapSettings#expungebehavior

func FormatIsValid

func FormatIsValid(format string) bool

FormatIsValid checks if the given Format is valid see: https://developers.google.com/gmail/api/reference/rest/v1/Format

func GetAttachment

func GetAttachment(userID, messageID, id, fields string) (*gmail.MessagePartBody, error)

GetAttachment gets the specified message attachment.

func GetAutoForwardingSettings

func GetAutoForwardingSettings(userID, fields string) (*gmail.AutoForwarding, error)

GetAutoForwardingSettings gets the auto-forwarding setting for the specified account.

func GetDelegate

func GetDelegate(userID, delegateEmail, fields string) (*gmail.Delegate, error)

GetDelegate gets the specified delegate. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.

func GetDraft

func GetDraft(userID, id, format, fields string) (*gmail.Draft, error)

GetDraft gets the specified draft.

func GetFilter

func GetFilter(userID, id, fields string) (*gmail.Filter, error)

GetFilter gets a filter.

func GetForwardingAddress

func GetForwardingAddress(userID, forwardingEmail, fields string) (*gmail.ForwardingAddress, error)

GetForwardingAddress gets the specified forwarding address.

func GetIMAPSettings

func GetIMAPSettings(userID, fields string) (*gmail.ImapSettings, error)

GetIMAPSettings gets IMAP settings.

func GetLabel

func GetLabel(userID, id, fields string) (*gmail.Label, error)

GetLabel gets the specified label.

func GetLanguageSettings

func GetLanguageSettings(userID, fields string) (*gmail.LanguageSettings, error)

GetLanguageSettings gets language settings.

func GetMessage

func GetMessage(userID, id, format, metadataHeaders, fields string) (*gmail.Message, error)

GetMessage gets the specified message.

func GetPOPSettings

func GetPOPSettings(userID, fields string) (*gmail.PopSettings, error)

GetPOPSettings gets POP settings.

func GetSendAs

func GetSendAs(userID, sendAsEmail, fields string) (*gmail.SendAs, error)

GetSendAs gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection.

func GetSmimeInfo

func GetSmimeInfo(userID, sendAsEmail, id, fields string) (*gmail.SmimeInfo, error)

GetSmimeInfo gets the specified S/MIME config for the specified send-as alias.

func GetThread

func GetThread(userID, id, format, metadataHeaders, fields string) (*gmail.Thread, error)

GetThread gets the specified thread.

func GetUserProfile

func GetUserProfile(userID, fields string) (*gmail.Profile, error)

GetUserProfile Ggts the specified user's Gmail profile.

func GetVacationResponderSettings

func GetVacationResponderSettings(userID, fields string) (*gmail.VacationSettings, error)

GetVacationResponderSettings gets vacation responder settings.

func HistoryTypeIsValid

func HistoryTypeIsValid(historyType string) bool

HistoryTypeIsValid checks if the given HistoryType is valid see: https://developers.google.com/gmail/api/reference/rest/v1/users.history/list#historytype

func ImportMessage

func ImportMessage(userID, internalDateSource, fields string, message *gmail.Message, deleted, neverMarkSpam, processForCalendar bool) (*gmail.Message, error)

ImportMessage imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message.

func InsertMessage

func InsertMessage(userID, internalDateSource, fields string, message *gmail.Message, deleted bool) (*gmail.Message, error)

InsertMessage directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.

func InsertSmimeInfo

func InsertSmimeInfo(userID, sendAsEmail, fields string, smimeInfo *gmail.SmimeInfo) (*gmail.SmimeInfo, error)

InsertSmimeInfo uploads the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key.

func InternalDateSourceIsValid

func InternalDateSourceIsValid(internalDateSource string) bool

InternalDateSourceIsValid checks if the given internalDateSource is valid see: https://developers.google.com/gmail/api/reference/rest/v1/InternalDateSource

func LabelListVisibilityIsValid

func LabelListVisibilityIsValid(labelListVisibility string) bool

LabelListVisibilityIsValid checks if the given LabelListVisibility is valid see: https://developers.google.com/gmail/api/reference/rest/v1/users.labels#MessageListVisibility

func ListDelegates

func ListDelegates(userID, fields string) ([]*gmail.Delegate, error)

ListDelegates lists the delegates for the specified account. This method is only available to service account clients that have been delegated domain-wide authority.

func ListDrafts

func ListDrafts(userID, q, fields string, includeSpamTrash bool, cap int) (<-chan *gmail.Draft, <-chan error)

ListDrafts lists the drafts in the user's mailbox.

func ListFilters

func ListFilters(userID, fields string) ([]*gmail.Filter, error)

ListFilters lists the message filters of a Gmail user.

func ListForwardingAddresses

func ListForwardingAddresses(userID, fields string) ([]*gmail.ForwardingAddress, error)

ListForwardingAddresses lists the forwarding addresses for the specified account.

func ListHistory

func ListHistory(userID, labelID, fields string, startHistoryID uint64, historyTypes []string, cap int) (<-chan *gmail.History, <-chan error)

ListHistory lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId).

func ListLabels

func ListLabels(userID, fields string) ([]*gmail.Label, error)

ListLabels lists all labels in the user's mailbox.

func ListMessages

func ListMessages(userID, q, fields string, labelIds []string, includeSpamTrash bool, cap int) (<-chan *gmail.Message, <-chan error)

ListMessages lists the messages in the user's mailbox.

func ListSendAs

func ListSendAs(userID, fields string) ([]*gmail.SendAs, error)

ListSendAs lists the send-as aliases for the specified account. The result includes the primary send-as address associated with the account as well as any custom "from" aliases.

func ListSmimeInfo

func ListSmimeInfo(userID, sendAsEmail, fields string) ([]*gmail.SmimeInfo, error)

ListSmimeInfo lists S/MIME configs for the specified send-as alias.

func ListThreads

func ListThreads(userID, q, fields string, labelIDs []string, includeSpamTrash bool, cap int) (<-chan *gmail.Thread, <-chan error)

ListThreads lists the threads in the user's mailbox.

func MessageVisibilityIsValid

func MessageVisibilityIsValid(messageVisibility string) bool

MessageVisibilityIsValid checks if the given MessageVisibility is valid see: https://developers.google.com/gmail/api/reference/rest/v1/users.labels#MessageListVisibility

func ModifyMessage

func ModifyMessage(userID, id, fields string, addLabelIds, removeLabelIds []string) (*gmail.Message, error)

ModifyMessage modifies the labels on the specified message.

func ModifyThread

func ModifyThread(userID, id, fields string, addLabelIds, removeLabelIds []string) (*gmail.Thread, error)

ModifyThread modifies the labels applied to the thread. This applies to all messages in the thread.

func PatchLabel

func PatchLabel(userID, id, fields string, label *gmail.Label) (*gmail.Label, error)

PatchLabel PATCHes the specified label.

func PatchSendAs

func PatchSendAs(userID, sendAsEmail, fields string, sendAs *gmail.SendAs) (*gmail.SendAs, error)

PatchSendAs PATCHes the specified send-as alias.

func SecurityModeIsValid

func SecurityModeIsValid(SecurityMode string) bool

SecurityModeIsValid checks if the given SecurityMode is valid see: https://developers.google.com/gmail/api/reference/rest/v1/PopSettings#securitymode

func SendDraft

func SendDraft(userID string, draft *gmail.Draft, media ...io.Reader) (*gmail.Message, error)

SendDraft sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.

func SendMessage

func SendMessage(userID, fields string, message *gmail.Message) (*gmail.Message, error)

SendMessage sends the specified message to the recipients in the To, Cc, and Bcc headers.

func SetClient

func SetClient(c *http.Client)

SetClient is used to inject a *http.Client into the package

func SetDefaultSmimeInfo

func SetDefaultSmimeInfo(userID, sendAsEmail, id string) (bool, error)

SetDefaultSmimeInfo sets the default S/MIME config for the specified send-as alias.

func SizeComparisonIsValid

func SizeComparisonIsValid(sizeComparison string) bool

SizeComparisonIsValid checks if the given SizeComparison is valid see: https://developers.google.com/gmail/api/reference/rest/v1/PopSettings#sizecomparison

func TrashMessage

func TrashMessage(userID, id, fields string) (*gmail.Message, error)

TrashMessage moves the specified message to the trash.

func TrashThread

func TrashThread(userID, id, fields string) (*gmail.Thread, error)

TrashThread moves the specified thread to the trash.

func UntrashMessage

func UntrashMessage(userID, id, fields string) (*gmail.Message, error)

UntrashMessage removes the specified message from the trash.

func UntrashThread

func UntrashThread(userID, id, fields string) (*gmail.Thread, error)

UntrashThread removes the specified thread from the trash.

func UpdateAutoForwardingSettings

func UpdateAutoForwardingSettings(userID, fields string, autoForwarding *gmail.AutoForwarding) (*gmail.AutoForwarding, error)

UpdateAutoForwardingSettings updates the auto-forwarding setting for the specified account. A verified forwarding address must be specified when auto-forwarding is enabled.

func UpdateDraft

func UpdateDraft(userID, id, fields string, draft *gmail.Draft, media ...io.Reader) (*gmail.Draft, error)

UpdateDraft replaces a draft's content.

func UpdateIMAPSettings

func UpdateIMAPSettings(userID, fields string, imapSettings *gmail.ImapSettings) (*gmail.ImapSettings, error)

UpdateIMAPSettings updates IMAP settings.

func UpdateLanguageSettings

func UpdateLanguageSettings(userID, fields string, languageSetting *gmail.LanguageSettings) (*gmail.LanguageSettings, error)

UpdateLanguageSettings updates language settings. If successful, the return object contains the displayLanguage that was saved for the user,which may differ from the value passed into the request. This is because the requested displayLanguage may not be directly supported by Gmail but have a close variant that is, and so the variant may be chosen and saved instead.

func UpdatePOPSettings

func UpdatePOPSettings(userID, fields string, popSettings *gmail.PopSettings) (*gmail.PopSettings, error)

UpdatePOPSettings updates POP settings.

func UpdateVacationResponderSettings

func UpdateVacationResponderSettings(userID, fields string, vacationSettings *gmail.VacationSettings) (*gmail.VacationSettings, error)

UpdateVacationResponderSettings updates vacation responder settings.

func VerifySendAs

func VerifySendAs(userID, sendAsEmail string) (bool, error)

VerifySendAs sends a verification email to the specified send-as alias address. The verification status must be pending.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL