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	InReplyTo  string
16	References []string
17}
18
19// A message to indicate that the user has entered their credentials.
20type Credentials struct {
21	Provider string
22	Name     string
23	Email    string
24	Password string
25}
26
27// A message to indicate that the user has chosen a service.
28type ChooseServiceMsg struct {
29	Service string
30}
31
32// EmailResultMsg is sent after an email sending attempt.
33// If Err is not nil, the email failed to send.
34type EmailResultMsg struct {
35	Err error
36}
37
38// ClearStatusMsg is sent to clear the status message from the view.
39type ClearStatusMsg struct{}
40
41// A message containing the fetched emails.
42type EmailsFetchedMsg struct {
43	Emails []fetcher.Email
44}
45
46// A message to indicate that an error occurred while fetching emails.
47type FetchErr error
48
49// A message to navigate to the inbox view.
50type GoToInboxMsg struct{}
51
52// A message to navigate to the composer view.
53type GoToSendMsg struct {
54	To      string
55	Subject string
56	Body    string
57}
58
59// A message to navigate to the settings view.
60type GoToSettingsMsg struct{}
61
62// A message to fetch more emails with a given offset.
63type FetchMoreEmailsMsg struct {
64	Offset uint32
65}
66
67// A message to indicate that the app is fetching more emails.
68type FetchingMoreEmailsMsg struct{}
69
70// A message to indicate that new emails have been fetched and should be appended.
71type EmailsAppendedMsg struct {
72	Emails []fetcher.Email
73}
74
75// A message to reply to an email.
76type ReplyToEmailMsg struct {
77	Email fetcher.Email
78}
79
80// A message to set the composer cursor to the start.
81type SetComposerCursorToStartMsg struct{}