interfaces

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIService added in v0.1.1

type AIService interface {
	GetStructuredEmailBody(ctx context.Context, request dto.StructuredEmailRequest) (*dto.StructuredEmailResponse, error)
}

type CloudflareService added in v0.0.3

type CloudflareService interface {
	SetupDomainForMailStack(ctx context.Context, tenant, domain, destinationUrl string) ([]string, error)
	AddDNSRecord(ctx context.Context, zoneID, recordType, name, content string, ttl int, proxied bool, priority *int) error
	GetDNSRecords(ctx context.Context, domain string) (*[]DNSRecord, error)
	DeleteDNSRecord(ctx context.Context, zoneID string, recordID string) error
	CheckDomainExists(ctx context.Context, domain string) (bool, string, error)
}

type CreateMailboxRequest added in v0.0.3

type CreateMailboxRequest struct {
	Domain                string
	Username              string
	Password              string
	UserId                string
	WebmailEnabled        bool
	ForwardingTo          []string
	IgnoreDomainOwnership bool
}

type DNSRecord added in v0.0.3

type DNSRecord struct {
	ID      string `json:"id"`
	ZoneID  string `json:"zone_id"`
	Name    string `json:"zone_name"`
	Type    string `json:"type"`
	Content string `json:"content"`
}

type DomainService added in v0.0.3

type DomainService interface {
	ConfigureDomain(ctx context.Context, domain, redirectWebsite string) error
	GetDomain(ctx context.Context, domain string) (*models.MailStackDomain, error)
	CheckMailstackDomainReputations(ctx context.Context) error
	GetTenantForMailstackDomain(ctx context.Context, domain string) (string, error)
}

type EmailAttachmentRepository

type EmailAttachmentRepository interface {
	Create(ctx context.Context, attachment *models.EmailAttachment) error
	GetByID(ctx context.Context, id string) (*models.EmailAttachment, error)
	ListByEmail(ctx context.Context, emailID string) ([]*models.EmailAttachment, error)
	Store(ctx context.Context, attachment *models.EmailAttachment, data []byte) error
	GetAttachment(ctx context.Context, id string) ([]byte, error)
	Delete(ctx context.Context, id string) error
}

type EmailFilterService

type EmailFilterService interface {
	ScanEmail(ctx context.Context, email *models.Email) error
}

type EmailRepository

type EmailRepository interface {
	Create(ctx context.Context, email *models.Email) (string, error)
	GetByID(ctx context.Context, id string) (*models.Email, error)
	GetByUID(ctx context.Context, mailboxID, folder string, uid uint32) (*models.Email, error)
	GetByMessageID(ctx context.Context, messageID string) (*models.Email, error)
	ListByMailbox(ctx context.Context, mailboxID string, limit, offset int) ([]*models.Email, int64, error)
	ListByFolder(ctx context.Context, mailboxID, folder string, limit, offset int) ([]*models.Email, int64, error)
	ListByThread(ctx context.Context, threadID string) ([]*models.Email, error)
	Search(ctx context.Context, query string, limit, offset int) ([]*models.Email, int64, error)
	Update(ctx context.Context, email *models.Email) error
	SetEmailRawData(ctx context.Context, emailID string, headers, envelope, bodyStructure models.JSONMap) error
}

type EmailService

type EmailService interface {
	Send()
	GetMessage()
}

type EmailThreadRepository added in v0.0.3

type EmailThreadRepository interface {
	Create(ctx context.Context, thread *models.EmailThread) (string, error)
	GetByID(ctx context.Context, id string) (*models.EmailThread, error)
	Update(ctx context.Context, thread *models.EmailThread) error
	List(ctx context.Context, mailboxID string, limit, offset int) ([]*models.EmailThread, error)
	GetByMessageID(ctx context.Context, messageID string) (*models.EmailThread, error)
	IncrementMessageCount(ctx context.Context, threadID string, messageID string, messageTime time.Time) error
	GetParticipantsForThread(ctx context.Context, threadID string) ([]string, error)
	FindBySubjectAndMailbox(ctx context.Context, subject string, mailboxID string) ([]*models.EmailThread, error)
}

type FolderStats

type FolderStats struct {
	Total    uint32
	Unseen   uint32
	LastSeen uint32
	LastSync time.Time
}

type IMAPService

type IMAPService interface {
	Start(ctx context.Context) error
	Stop() error
	AddMailbox(ctx context.Context, mailbox *models.Mailbox) error
	RemoveMailbox(ctx context.Context, mailboxID string) error
	Status() map[string]MailboxStatus
	SetEventHandler(handler func(ctx context.Context, mailEvent MailEvent))
}

type MailEvent

type MailEvent struct {
	Source    string
	MailboxID string
	Folder    string
	MessageID uint32
	EventType string
	Message   interface{}
}

type MailboxDetails added in v0.0.3

type MailboxDetails struct {
	Email             string   `json:"email"`
	ForwardingEnabled bool     `json:"forwardingEnabled"`
	ForwardingTo      []string `json:"forwardingTo"`
	WebmailEnabled    bool     `json:"webmailEnabled"`
}

type MailboxRepository

type MailboxRepository interface {
	GetMailboxes(ctx context.Context) ([]*models.Mailbox, error)
	GetMailbox(ctx context.Context, id string) (*models.Mailbox, error)
	GetMailboxByEmailAddress(ctx context.Context, emailAddress string) (*models.Mailbox, error)
	SaveMailbox(ctx context.Context, mailbox models.Mailbox) (string, error)
	DeleteMailbox(ctx context.Context, id string) error
	UpdateConnectionStatus(ctx context.Context, mailboxID string, status enum.ConnectionStatus, errorMessage string) error
}

type MailboxService added in v0.0.3

type MailboxService interface {
	CreateMailbox(ctx context.Context, tx *gorm.DB, request CreateMailboxRequest) error
	IsDomainAvailable(ctx context.Context, domain string) (ok, available bool)
	RecommendOutboundDomains(ctx context.Context, domainRoot string, count int) []string
	ReputationScore(ctx context.Context, domain, tenant string) (int, error)
	GetMailboxes(ctx context.Context, domain, userId string) ([]*models.TenantSettingsMailbox, error)
	GetByMailbox(ctx context.Context, username, domain string) (*models.TenantSettingsMailbox, error)
	RampUpMailboxes(ctx context.Context) error
	ConfigureMailbox(ctx context.Context, mailboxId string) error
}

type MailboxStatus

type MailboxStatus struct {
	Connected   bool
	LastError   string
	Folders     map[string]FolderStats
	LastChecked time.Time
}

type MailboxSyncRepository

type MailboxSyncRepository interface {
	GetSyncState(ctx context.Context, mailboxID, folderName string) (*models.MailboxSyncState, error)
	SaveSyncState(ctx context.Context, state *models.MailboxSyncState) error
	DeleteSyncState(ctx context.Context, mailboxID, folderName string) error
	DeleteMailboxSyncStates(ctx context.Context, mailboxID string) error
	GetAllSyncStates(ctx context.Context) (map[string]map[string]uint32, error)
	GetMailboxSyncStates(ctx context.Context, mailboxID string) (map[string]uint32, error)
}

type NamecheapDomainInfo added in v0.0.3

type NamecheapDomainInfo struct {
	DomainName  string   `json:"domainName"`
	CreatedDate string   `json:"createdDate"`
	ExpiredDate string   `json:"expiredDate"`
	Nameservers []string `json:"nameservers"`
	WhoisGuard  bool     `json:"whoisGuard"`
}

type NamecheapService added in v0.0.3

type NamecheapService interface {
	CheckDomainAvailability(ctx context.Context, domain string) (bool, bool, error)
	PurchaseDomain(ctx context.Context, tenant, domain string) error
	GetDomainPrice(ctx context.Context, domain string) (float64, error)
	GetDomainInfo(ctx context.Context, tenant, domain string) (NamecheapDomainInfo, error)
	UpdateNameservers(ctx context.Context, tenant, domain string, nameservers []string) error
}

type OpenSrsService added in v0.0.3

type OpenSrsService interface {
	SendEmail(ctx context.Context, request *models.EmailMessage) error
	SetupDomain(ctx context.Context, tenant, domain string) error
	SetupMailbox(ctx context.Context, tenant, username, password string, forwardingTo []string, webmailEnabled bool) error
	GetMailboxDetails(ctx context.Context, email string) (MailboxDetails, error)
}

type OrphanEmailRepository added in v0.0.3

type OrphanEmailRepository interface {
	Create(ctx context.Context, orphan *models.OrphanEmail) (string, error)
	GetByID(ctx context.Context, id string) (*models.OrphanEmail, error)
	GetByMessageID(ctx context.Context, messageID string) (*models.OrphanEmail, error)
	Delete(ctx context.Context, id string) error
	DeleteByThreadID(ctx context.Context, threadID string) error
	ListByThreadID(ctx context.Context, threadID string) ([]*models.OrphanEmail, error)
	ListByMailboxID(ctx context.Context, mailboxID string, limit, offset int) ([]*models.OrphanEmail, error)
	DeleteOlderThan(ctx context.Context, cutoffDate time.Time) error
}

type SenderRepository added in v0.0.22

type SenderRepository interface {
	Create(ctx context.Context, sender *models.Sender) error
	GetByID(ctx context.Context, id string) (*models.Sender, error)
	GetByUserID(ctx context.Context, userID string) ([]models.Sender, error)
	GetDefaultForUser(ctx context.Context, userID string) (*models.Sender, error)
	Update(ctx context.Context, sender *models.Sender) error
	SetDefault(ctx context.Context, id string, userID string) error
	SetActive(ctx context.Context, id string, isActive bool) error
	Delete(ctx context.Context, id string) error
	ListByTenant(ctx context.Context, tenant string, limit, offset int) ([]models.Sender, int64, error)
}

type StorageService

type StorageService interface {
	Upload(ctx context.Context, key string, data []byte, contentType string) error
	Download(ctx context.Context, key string) ([]byte, error)
	Delete(ctx context.Context, key string) error
	GetPublicURL(key string) string
}

Jump to

Keyboard shortcuts

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