Implement internal mail skill MVP
This commit is contained in:
124
internal/model/model.go
Normal file
124
internal/model/model.go
Normal file
@@ -0,0 +1,124 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type Address struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
|
||||
type ParsedAttachment struct {
|
||||
Filename string `json:"filename"`
|
||||
ContentType string `json:"content_type"`
|
||||
ContentID string `json:"content_id,omitempty"`
|
||||
SizeBytes int64 `json:"size_bytes"`
|
||||
Data []byte `json:"-"`
|
||||
}
|
||||
|
||||
type ParsedEmail struct {
|
||||
MessageIDHeader string `json:"message_id_header"`
|
||||
InReplyTo string `json:"in_reply_to"`
|
||||
References string `json:"references_header"`
|
||||
Subject string `json:"subject"`
|
||||
SenderName string `json:"sender_name"`
|
||||
SenderEmail string `json:"sender_email"`
|
||||
To []Address `json:"to"`
|
||||
Cc []Address `json:"cc"`
|
||||
DateHeader string `json:"date_header"`
|
||||
SentAt *time.Time `json:"sent_at,omitempty"`
|
||||
BodyText string `json:"body_text"`
|
||||
BodyHTML string `json:"body_html"`
|
||||
Attachments []ParsedAttachment `json:"attachments"`
|
||||
}
|
||||
|
||||
type Attachment struct {
|
||||
ID int64 `json:"attachment_id"`
|
||||
MessageID int64 `json:"-"`
|
||||
Filename string `json:"filename"`
|
||||
ContentType string `json:"content_type"`
|
||||
ContentID string `json:"content_id,omitempty"`
|
||||
SizeBytes int64 `json:"size_bytes"`
|
||||
}
|
||||
|
||||
type Label struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Color string `json:"color,omitempty"`
|
||||
}
|
||||
|
||||
type LocalStatus struct {
|
||||
Read bool `json:"read"`
|
||||
Processed bool `json:"processed"`
|
||||
Archived bool `json:"archived"`
|
||||
Deleted bool `json:"deleted"`
|
||||
Replied bool `json:"replied"`
|
||||
}
|
||||
|
||||
type EmailSummary struct {
|
||||
ID int64 `json:"id"`
|
||||
Subject string `json:"subject"`
|
||||
SenderName string `json:"sender_name"`
|
||||
SenderEmail string `json:"sender_email"`
|
||||
To []Address `json:"to"`
|
||||
Cc []Address `json:"cc,omitempty"`
|
||||
DateHeader string `json:"date"`
|
||||
SentAt *time.Time `json:"sent_at,omitempty"`
|
||||
ReceivedAt *time.Time `json:"received_at,omitempty"`
|
||||
Snippet string `json:"snippet"`
|
||||
HasAttachment bool `json:"has_attachment"`
|
||||
AttachmentCount int `json:"attachment_count"`
|
||||
LocalStatus LocalStatus `json:"local_status"`
|
||||
Labels []Label `json:"labels"`
|
||||
}
|
||||
|
||||
type EmailDetail struct {
|
||||
ID int64 `json:"id"`
|
||||
MessageIDHeader string `json:"message_id_header"`
|
||||
InReplyTo string `json:"in_reply_to,omitempty"`
|
||||
References string `json:"references_header,omitempty"`
|
||||
Subject string `json:"subject"`
|
||||
SenderName string `json:"from_name"`
|
||||
SenderEmail string `json:"from_email"`
|
||||
To []Address `json:"to"`
|
||||
Cc []Address `json:"cc"`
|
||||
DateHeader string `json:"date"`
|
||||
SentAt *time.Time `json:"sent_at,omitempty"`
|
||||
ReceivedAt *time.Time `json:"received_at,omitempty"`
|
||||
BodyText string `json:"body_text"`
|
||||
BodyHTML string `json:"body_html"`
|
||||
Attachments []Attachment `json:"attachments"`
|
||||
LocalStatus LocalStatus `json:"local_status"`
|
||||
Labels []Label `json:"labels"`
|
||||
}
|
||||
|
||||
type Draft struct {
|
||||
ID int64 `json:"id"`
|
||||
To []string `json:"to"`
|
||||
Cc []string `json:"cc"`
|
||||
Bcc []string `json:"bcc"`
|
||||
Subject string `json:"subject"`
|
||||
Body string `json:"body"`
|
||||
ReplyToEmailID *int64 `json:"reply_to_email_id,omitempty"`
|
||||
Status string `json:"status"`
|
||||
LastError string `json:"last_error,omitempty"`
|
||||
SentMessageID *int64 `json:"sent_message_id,omitempty"`
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
type FetchedMessage struct {
|
||||
ServerID int `json:"server_id"`
|
||||
UID string `json:"uid"`
|
||||
Raw []byte `json:"-"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
type SentMessage struct {
|
||||
ID int64 `json:"id"`
|
||||
DraftID *int64 `json:"draft_id,omitempty"`
|
||||
Subject string `json:"subject"`
|
||||
MessageIDHeader string `json:"message_id_header,omitempty"`
|
||||
Status string `json:"status"`
|
||||
ErrorMessage string `json:"error_message,omitempty"`
|
||||
SentAt *time.Time `json:"sent_at,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user