inbox

package
v4.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inbox

type Inbox[M client.MailDoc] struct {
	Name       string      `json:"name"`
	InboxItems []InboxItem `json:"mails"`
	// contains filtered or unexported fields
}

Inbox represents a mail collection

func NewInbox

func NewInbox[M client.MailDoc](name string, enableDebugMode bool) (*Inbox[M], error)

NewInbox creates a new mail inbox

func (*Inbox[M]) Add

func (i *Inbox[M]) Add(inboxItem InboxItem)

Add appends a mail to mail list

func (*Inbox[M]) Coloured

func (i *Inbox[M]) Coloured() (string, error)

func (*Inbox[M]) Count

func (i *Inbox[M]) Count() int

Count returns total number of mails available in inbox

func (*Inbox[M]) Delete

func (i *Inbox[M]) Delete(position int) error

Delete an email

func (*Inbox[M]) Fetch

func (i *Inbox[M]) Fetch(offset int) (Render, error)

Fetch retrieves the full email content from the given inbox email offset

func (*Inbox[M]) Flush

func (i *Inbox[M]) Flush() error

Flush empties an inbox

func (*Inbox[M]) GetMails

func (i *Inbox[M]) GetMails() []InboxItem

func (*Inbox[M]) JSON

func (i *Inbox[M]) JSON() (string, error)

func (*Inbox[M]) ParseInboxPages

func (i *Inbox[M]) ParseInboxPages(limit int) error

ParseInboxPages parses inbox email in given page

func (*Inbox[M]) Shrink

func (i *Inbox[M]) Shrink(limit int)

Shrink reduces mails size to given value

type InboxItem

type InboxItem struct {
	ID      string     `json:"id"`
	Sender  *Sender    `json:"sender,omitempty"`
	Subject string     `json:"subject"`
	Date    *time.Time `json:"date,omitempty"`
	Body    string     `json:"body,omitempty"`
	IsSPAM  bool       `json:"isSPAM"`
}

Inbox represents a mail sumup in an inbox

type Render

type Render interface {
	Coloured() (string, error)
	JSON() (string, error)
}

type Sender

type Sender struct {
	Mail string `json:"mail,omitempty"`
	Name string `json:"name,omitempty"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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