messages.go

 1package tui
 2
 3import "github.com/andrinoff/email-cli/fetcher"
 4
 5// A message to view an email.
 6type ViewEmailMsg struct {
 7	Index int
 8}
 9
10// A message to indicate that an email has been sent.
11type SendEmailMsg struct {
12	To             string
13	Subject        string
14	Body           string
15	AttachmentPath string
16	InReplyTo      string
17	References     []string
18}
19
20// A message to indicate that the user has entered their credentials.
21type Credentials struct {
22	Provider string
23	Name     string
24	Email    string
25	Password string
26}
27
28// A message to indicate that the user has chosen a service.
29type ChooseServiceMsg struct {
30	Service string
31}
32
33// EmailResultMsg is sent after an email sending attempt.
34// If Err is not nil, the email failed to send.
35type EmailResultMsg struct {
36	Err error
37}
38
39// ClearStatusMsg is sent to clear the status message from the view.
40type ClearStatusMsg struct{}
41
42// A message containing the fetched emails.
43type EmailsFetchedMsg struct {
44	Emails []fetcher.Email
45}
46
47// A message to indicate that an error occurred while fetching emails.
48type FetchErr error
49
50// A message to navigate to the inbox view.
51type GoToInboxMsg struct{}
52
53// A message to navigate to the composer view.
54type GoToSendMsg struct {
55	To      string
56	Subject string
57	Body    string
58}
59
60// A message to navigate to the settings view.
61type GoToSettingsMsg struct{}
62
63// A message to fetch more emails with a given offset.
64type FetchMoreEmailsMsg struct {
65	Offset uint32
66}
67
68// A message to indicate that the app is fetching more emails.
69type FetchingMoreEmailsMsg struct{}
70
71// A message to indicate that new emails have been fetched and should be appended.
72type EmailsAppendedMsg struct {
73	Emails []fetcher.Email
74}
75
76// A message to reply to an email.
77type ReplyToEmailMsg struct {
78	Email fetcher.Email
79}
80
81// A message to set the composer cursor to the start.
82type SetComposerCursorToStartMsg struct{}
83
84// --- File Picker Messages ---
85
86// A message to open the file picker.
87type GoToFilePickerMsg struct{}
88
89// A message sent when a file has been selected.
90type FileSelectedMsg struct {
91	Path string
92}
93
94// A message to cancel the file picker and return to the previous view.
95type CancelFilePickerMsg struct{}