Documentation ¶
Index ¶
- func Delete(ctx context.Context, client api.DeleteThreadAPI, messageID string) error
- func StoreEmail(ctx context.Context, client api.StoreEmailAPI, input *StoreEmailInput)
- func StoreEmailWithExistingThread(ctx context.Context, client api.TransactWriteItemsAPI, ...) error
- func StoreEmailWithNewThread(ctx context.Context, client api.TransactWriteItemsAPI, ...) error
- func Trash(ctx context.Context, client api.UpdateItemAPI, threadID string) error
- func Untrash(ctx context.Context, client api.UpdateItemAPI, messageID string) error
- type DetermineThreadInput
- type DetermineThreadOutput
- type StoreEmailInput
- type StoreEmailWithExistingThreadInput
- type StoreEmailWithNewThreadInput
- type Thread
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶ added in v1.7.0
Delete deletes a trashed thread as well as its emails from DynamoDB and S3. It will return an error if the thread is not trashed.
func StoreEmail ¶
func StoreEmail(ctx context.Context, client api.StoreEmailAPI, input *StoreEmailInput)
StoreEmail attempts to store the email. If error occurs, it will be logged and the function will return.
func StoreEmailWithExistingThread ¶
func StoreEmailWithExistingThread(ctx context.Context, client api.TransactWriteItemsAPI, input *StoreEmailWithExistingThreadInput) error
StoreEmailWithExistingThread stores the email and updates the thread.
func StoreEmailWithNewThread ¶
func StoreEmailWithNewThread(ctx context.Context, client api.TransactWriteItemsAPI, input *StoreEmailWithNewThreadInput) error
StoreEmailWithNewThread stores the email, creates a new thread, and add ThreadID to previous email
Types ¶
type DetermineThreadInput ¶
type DetermineThreadOutput ¶
type DetermineThreadOutput struct { ThreadID string Exists bool // If true, the email belongs to an existing thread PreviousMessageID string // If Exists is true, the messageID of the last email in the thread ShouldCreate bool // If true, a new thread should be created CreatingEmailID string // If ShouldCreate is true, the messageID of the first email in the thread CreatingSubject string // If ShouldCreate is true, the subject of the first email in the thread CreatingTime string // If ShouldCreate is true, the time the first email is received }
func DetermineThread ¶
func DetermineThread(ctx context.Context, client api.QueryAndGetItemAPI, input *DetermineThreadInput) (*DetermineThreadOutput, error)
DetermineThread determines which thread an incoming email belongs to. If a thread already exists, the ThreadID is returned and Exists is true. If a thread does not exist and a new thread should be created, the ThreadID is randomly generated and ShouldCreate is true.
type StoreEmailInput ¶
type StoreEmailInput struct { InReplyTo string References string Item map[string]dynamodbTypes.AttributeValue TimeReceived string // RFC3339 }
type StoreEmailWithExistingThreadInput ¶
type StoreEmailWithExistingThreadInput struct { ThreadID string Email map[string]dynamodbTypes.AttributeValue TimeReceived string PreviousMessageID string }
type StoreEmailWithNewThreadInput ¶
type StoreEmailWithNewThreadInput struct { ThreadID string Email map[string]dynamodbTypes.AttributeValue TimeReceived string CreatingEmailID string CreatingSubject string CreatingTime string }
type Thread ¶
type Thread struct { MessageID string `json:"messageID"` Type string `json:"type"` // always "thread" Subject string `json:"subject"` // The subject of the first email in the thread EmailIDs []string `json:"emailIDs"` DraftID string `json:"draftID,omitempty"` TimeUpdated string `json:"timeUpdated"` // The time the last email is received or sent TrashedTime *string `json:"trashedTime,omitempty"` // Time in RFC3339 format Emails []email.GetResult `json:"emails,omitempty"` Draft *email.GetResult `json:"draft,omitempty"` }