handlers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ARFReportResponse

type ARFReportResponse struct {
	ID               int64  `json:"id"`
	FeedbackType     string `json:"feedback_type"`
	UserAgent        string `json:"user_agent"`
	Version          string `json:"version"`
	SourceIP         string `json:"source_ip"`
	IncidentCount    int    `json:"incident_count"`
	OriginalMailFrom string `json:"original_mail_from"`
	OriginalRcptTo   string `json:"original_rcpt_to"`
	ReportedDomain   string `json:"reported_domain"`
	ReportedURI      string `json:"reported_uri"`
	AuthFailure      string `json:"auth_failure"`
	DeliveryResult   string `json:"delivery_result"`
	ReceivedDate     int64  `json:"received_date"`
	ProcessedAt      int64  `json:"processed_at"`
	ActionTaken      bool   `json:"action_taken"`
}

ARFReportResponse represents an ARF report in API responses

type ARFStatsResponse

type ARFStatsResponse struct {
	TotalReports     int            `json:"total_reports"`
	ByFeedbackType   map[string]int `json:"by_feedback_type"`
	ByDomain         map[string]int `json:"by_domain"`
	ActionTakenCount int            `json:"action_taken_count"`
	RecentTrend      string         `json:"recent_trend"`
}

ARFStatsResponse represents ARF statistics in API responses

type ActivityItem

type ActivityItem struct {
	Timestamp   string `json:"timestamp"`
	Type        string `json:"type"`
	Description string `json:"description"`
	UserEmail   string `json:"user_email,omitempty"`
	DomainName  string `json:"domain_name,omitempty"`
}

ActivityItem represents a recent activity entry

type AlertResponse

type AlertResponse struct {
	Timestamp int64  `json:"timestamp"`
	Domain    string `json:"domain"`
	Type      string `json:"type"`
	Message   string `json:"message"`
	Severity  string `json:"severity"`
}

AlertResponse represents a recent alert in API responses

type AliasHandler

type AliasHandler struct {
	// contains filtered or unexported fields
}

AliasHandler handles alias management endpoints

func NewAliasHandler

func NewAliasHandler(service *service.AliasService, logger *zap.Logger) *AliasHandler

NewAliasHandler creates a new alias handler

func (*AliasHandler) Create

func (h *AliasHandler) Create(w http.ResponseWriter, r *http.Request)

Create creates a new alias

func (*AliasHandler) Delete

func (h *AliasHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete deletes an alias

func (*AliasHandler) Get

Get retrieves a specific alias

func (*AliasHandler) List

func (h *AliasHandler) List(w http.ResponseWriter, r *http.Request)

List retrieves aliases with pagination and optional filtering

type AliasListResponse

type AliasListResponse struct {
	Aliases    []*AliasResponse `json:"aliases"`
	Page       int              `json:"page"`
	PageSize   int              `json:"page_size"`
	TotalPages int              `json:"total_pages"`
	TotalCount int64            `json:"total_count"`
}

AliasListResponse represents a paginated list of aliases

type AliasRequest

type AliasRequest struct {
	Address      string   `json:"address"`
	Destinations []string `json:"destinations"`
	DomainID     int64    `json:"domain_id"`
	Status       string   `json:"status,omitempty"`
}

AliasRequest represents an alias creation request

type AliasResponse

type AliasResponse struct {
	ID           int64    `json:"id"`
	Address      string   `json:"address"`
	Destinations []string `json:"destinations"`
	DomainID     int64    `json:"domain_id"`
	DomainName   string   `json:"domain_name,omitempty"`
	Status       string   `json:"status"`
	CreatedAt    string   `json:"created_at"`
}

AliasResponse represents an alias in API responses

type AuditHandler

type AuditHandler struct {
	// contains filtered or unexported fields
}

AuditHandler handles audit log viewing endpoints

func NewAuditHandler

func NewAuditHandler(service *service.AuditService, logger *zap.Logger) *AuditHandler

NewAuditHandler creates a new audit handler

func (*AuditHandler) GetStats

func (h *AuditHandler) GetStats(w http.ResponseWriter, r *http.Request)

GetStats returns audit log statistics

func (*AuditHandler) ListLogs

func (h *AuditHandler) ListLogs(w http.ResponseWriter, r *http.Request)

ListLogs lists audit logs with optional filtering

type AuditLogResponse

type AuditLogResponse struct {
	ID           int64  `json:"id"`
	Timestamp    string `json:"timestamp"`
	UserID       *int64 `json:"user_id,omitempty"`
	Username     string `json:"username,omitempty"`
	Action       string `json:"action"`
	ResourceType string `json:"resource_type"`
	ResourceID   string `json:"resource_id,omitempty"`
	Details      string `json:"details,omitempty"`
	IPAddress    string `json:"ip_address,omitempty"`
	UserAgent    string `json:"user_agent,omitempty"`
	Severity     string `json:"severity"`
	Success      bool   `json:"success"`
}

AuditLogResponse represents an audit log entry in API responses

type AuditRequest

type AuditRequest struct {
	SendingIP string `json:"sending_ip,omitempty"`
}

AuditRequest represents a request to audit a domain

type AuditResponse

type AuditResponse struct {
	Domain       string              `json:"domain"`
	Timestamp    int64               `json:"timestamp"`
	SPF          CheckStatusResponse `json:"spf"`
	DKIM         CheckStatusResponse `json:"dkim"`
	DMARC        CheckStatusResponse `json:"dmarc"`
	RDNS         CheckStatusResponse `json:"rdns"`
	FCrDNS       CheckStatusResponse `json:"fcrdns"`
	TLS          CheckStatusResponse `json:"tls"`
	MTASTS       CheckStatusResponse `json:"mta_sts"`
	PostmasterOK bool                `json:"postmaster_ok"`
	AbuseOK      bool                `json:"abuse_ok"`
	OverallScore int                 `json:"overall_score"`
	Issues       []string            `json:"issues"`
}

AuditResponse represents an audit result in API responses

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

AuthHandler handles authentication endpoints

func NewAuthHandler

func NewAuthHandler(userService *service.UserService, jwtSecret string, logger *zap.Logger) *AuthHandler

NewAuthHandler creates a new authentication handler

func (*AuthHandler) Login

func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)

Login handles user login

func (*AuthHandler) Refresh

func (h *AuthHandler) Refresh(w http.ResponseWriter, r *http.Request)

Refresh handles token refresh

type CalendarResponse

type CalendarResponse struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Color       string `json:"color,omitempty"`
	Description string `json:"description,omitempty"`
	Timezone    string `json:"timezone"`
}

CalendarResponse represents a calendar for webmail

type CheckStatusResponse

type CheckStatusResponse struct {
	Passed  bool                   `json:"passed"`
	Message string                 `json:"message"`
	Details map[string]interface{} `json:"details,omitempty"`
}

CheckStatusResponse represents a check status in API responses

type CircuitBreakerResponse

type CircuitBreakerResponse struct {
	ID           int64   `json:"id"`
	Domain       string  `json:"domain"`
	TriggerType  string  `json:"trigger_type"`
	TriggerValue float64 `json:"trigger_value"`
	Threshold    float64 `json:"threshold"`
	PausedAt     int64   `json:"paused_at"`
	ResumedAt    *int64  `json:"resumed_at,omitempty"`
	AutoResumed  bool    `json:"auto_resumed"`
	AdminNotes   string  `json:"admin_notes,omitempty"`
}

CircuitBreakerResponse represents a circuit breaker event in API responses

type ContactSearchResponse

type ContactSearchResponse struct {
	ID    int64  `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
	Tel   string `json:"tel,omitempty"`
}

ContactSearchResponse represents a contact search result

type CreateEventRequest

type CreateEventRequest struct {
	CalendarID  int64     `json:"calendar_id"`
	Summary     string    `json:"summary"`
	Description string    `json:"description,omitempty"`
	Location    string    `json:"location,omitempty"`
	StartTime   time.Time `json:"start_time"`
	EndTime     time.Time `json:"end_time"`
	AllDay      bool      `json:"all_day"`
	Timezone    string    `json:"timezone,omitempty"`
	Attendees   []string  `json:"attendees,omitempty"`
}

CreateEventRequest represents an event creation request

type CustomWarmupScheduleResponse

type CustomWarmupScheduleResponse struct {
	ID          int64             `json:"id"`
	Domain      string            `json:"domain"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	TotalDays   int               `json:"total_days"`
	CurrentDay  int               `json:"current_day"`
	IsActive    bool              `json:"is_active"`
	StartedAt   *int64            `json:"started_at,omitempty"`
	CompletedAt *int64            `json:"completed_at,omitempty"`
	CreatedAt   int64             `json:"created_at"`
	DailyLimits []*WarmupDayLimit `json:"daily_limits,omitempty"`
}

CustomWarmupScheduleResponse represents a custom warmup schedule in API responses

type DKIMGenerateRequest

type DKIMGenerateRequest struct {
	KeyType string `json:"key_type,omitempty"` // "rsa" or "ed25519", defaults to "rsa"
	KeySize int    `json:"key_size,omitempty"` // For RSA: 1024, 2048, 4096; defaults to 2048
}

DKIMGenerateRequest represents a DKIM key generation request

type DKIMGenerateResponse

type DKIMGenerateResponse struct {
	Selector   string `json:"selector"`
	PublicKey  string `json:"public_key"`
	DNSRecord  string `json:"dns_record"`
	DNSName    string `json:"dns_name"`
	DomainName string `json:"domain_name"`
}

DKIMGenerateResponse represents a DKIM key generation response

type DMARCActionResponse

type DMARCActionResponse struct {
	ID          int64  `json:"id"`
	ReportID    int64  `json:"report_id"`
	ActionType  string `json:"action_type"`
	TargetIP    string `json:"target_ip"`
	Reason      string `json:"reason"`
	ActionTaken bool   `json:"action_taken"`
	TakenAt     *int64 `json:"taken_at,omitempty"`
}

DMARCActionResponse represents a DMARC auto-action in API responses

type DMARCReportRecordResponse

type DMARCReportRecordResponse struct {
	ID          int64  `json:"id"`
	SourceIP    string `json:"source_ip"`
	Count       int    `json:"count"`
	Disposition string `json:"disposition"`
	DMARCResult string `json:"dmarc_result"`
	SPFDomain   string `json:"spf_domain"`
	SPFResult   string `json:"spf_result"`
	DKIMDomain  string `json:"dkim_domain"`
	DKIMResult  string `json:"dkim_result"`
	HeaderFrom  string `json:"header_from"`
}

DMARCReportRecordResponse represents a DMARC report record in API responses

type DMARCReportResponse

type DMARCReportResponse struct {
	ID               int64                        `json:"id"`
	ReportID         string                       `json:"report_id"`
	Domain           string                       `json:"domain"`
	OrgName          string                       `json:"org_name"`
	EmailAddress     string                       `json:"email_address"`
	BeginTime        int64                        `json:"begin_time"`
	EndTime          int64                        `json:"end_time"`
	RecordCount      int                          `json:"record_count"`
	SPFAlignedCount  int                          `json:"spf_aligned_count"`
	DKIMAlignedCount int                          `json:"dkim_aligned_count"`
	ProcessedAt      int64                        `json:"processed_at"`
	Records          []*DMARCReportRecordResponse `json:"records,omitempty"`
}

DMARCReportResponse represents a DMARC report in API responses

type DMARCStatsResponse

type DMARCStatsResponse struct {
	Domain            string  `json:"domain"`
	TotalReports      int     `json:"total_reports"`
	TotalMessages     int     `json:"total_messages"`
	SPFAlignmentRate  float64 `json:"spf_alignment_rate"`
	DKIMAlignmentRate float64 `json:"dkim_alignment_rate"`
	PassRate          float64 `json:"pass_rate"`
	FailRate          float64 `json:"fail_rate"`
	RecentTrend       string  `json:"recent_trend"`
}

DMARCStatsResponse represents DMARC statistics in API responses

type DashboardStats

type DashboardStats struct {
	TotalDomains      int64              `json:"total_domains"`
	ActiveDomains     int64              `json:"active_domains"`
	TotalUsers        int64              `json:"total_users"`
	ActiveUsers       int64              `json:"active_users"`
	QueuedMessages    int64              `json:"queued_messages"`
	FailedMessages    int64              `json:"failed_messages"`
	TotalStorageUsed  int64              `json:"total_storage_used"`
	TotalStorageQuota int64              `json:"total_storage_quota"`
	MessagesToday     int64              `json:"messages_today"`
	MessagesThisWeek  int64              `json:"messages_this_week"`
	MessagesThisMonth int64              `json:"messages_this_month"`
	RecentActivity    []ActivityItem     `json:"recent_activity"`
	TopDomainsByUsers []DomainStat       `json:"top_domains_by_users"`
	TopDomainsByUsage []DomainStat       `json:"top_domains_by_usage"`
	SystemHealth      SystemHealthStatus `json:"system_health"`
}

DashboardStats represents dashboard statistics

type DomainHandler

type DomainHandler struct {
	// contains filtered or unexported fields
}

DomainHandler handles domain management endpoints

func NewDomainHandler

func NewDomainHandler(service *service.DomainService, logger *zap.Logger) *DomainHandler

NewDomainHandler creates a new domain handler

func (*DomainHandler) Create

func (h *DomainHandler) Create(w http.ResponseWriter, r *http.Request)

Create creates a new domain

func (*DomainHandler) Delete

func (h *DomainHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete deletes a domain

func (*DomainHandler) GenerateDKIM

func (h *DomainHandler) GenerateDKIM(w http.ResponseWriter, r *http.Request)

GenerateDKIM generates DKIM keys for a domain

func (*DomainHandler) Get

Get retrieves a specific domain

func (*DomainHandler) List

func (h *DomainHandler) List(w http.ResponseWriter, r *http.Request)

List retrieves all domains

func (*DomainHandler) Update

func (h *DomainHandler) Update(w http.ResponseWriter, r *http.Request)

Update updates a domain

type DomainRequest

type DomainRequest struct {
	Name               string `json:"name"`
	Status             string `json:"status"`
	CatchallEmail      string `json:"catchall_email,omitempty"`
	MaxUsers           int    `json:"max_users,omitempty"`
	DefaultQuota       int64  `json:"default_quota,omitempty"`
	DKIMSelector       string `json:"dkim_selector,omitempty"`
	DKIMPrivateKey     string `json:"dkim_private_key,omitempty"`
	DKIMPublicKey      string `json:"dkim_public_key,omitempty"`
	SPFRecord          string `json:"spf_record,omitempty"`
	DMARCPolicy        string `json:"dmarc_policy,omitempty"`
	DMARCReportEmail   string `json:"dmarc_report_email,omitempty"`
	DKIMSigningEnabled bool   `json:"dkim_signing_enabled"`
	DKIMVerifyEnabled  bool   `json:"dkim_verify_enabled"`
}

DomainRequest represents a domain creation/update request

type DomainResponse

type DomainResponse struct {
	ID                 int64  `json:"id"`
	Name               string `json:"name"`
	Status             string `json:"status"`
	CatchallEmail      string `json:"catchall_email,omitempty"`
	MaxUsers           int    `json:"max_users"`
	DefaultQuota       int64  `json:"default_quota"`
	DKIMSelector       string `json:"dkim_selector,omitempty"`
	DKIMPublicKey      string `json:"dkim_public_key,omitempty"`
	SPFRecord          string `json:"spf_record,omitempty"`
	DMARCPolicy        string `json:"dmarc_policy,omitempty"`
	DMARCReportEmail   string `json:"dmarc_report_email,omitempty"`
	DKIMSigningEnabled bool   `json:"dkim_signing_enabled"`
	DKIMVerifyEnabled  bool   `json:"dkim_verify_enabled"`
	CreatedAt          string `json:"created_at"`
	UpdatedAt          string `json:"updated_at"`
}

DomainResponse represents a domain in API responses

type DomainStat

type DomainStat struct {
	DomainID     int64  `json:"domain_id"`
	DomainName   string `json:"domain_name"`
	UserCount    int64  `json:"user_count"`
	StorageUsed  int64  `json:"storage_used"`
	MessageCount int64  `json:"message_count"`
}

DomainStat represents domain statistics

type DomainStats

type DomainStats struct {
	DomainID          int64      `json:"domain_id"`
	DomainName        string     `json:"domain_name"`
	Status            string     `json:"status"`
	TotalUsers        int64      `json:"total_users"`
	ActiveUsers       int64      `json:"active_users"`
	DisabledUsers     int64      `json:"disabled_users"`
	TotalStorageUsed  int64      `json:"total_storage_used"`
	TotalStorageQuota int64      `json:"total_storage_quota"`
	TotalAliases      int64      `json:"total_aliases"`
	MessagesToday     int64      `json:"messages_today"`
	MessagesThisWeek  int64      `json:"messages_this_week"`
	MessagesThisMonth int64      `json:"messages_this_month"`
	TopUsers          []UserStat `json:"top_users"`
}

DomainStats represents statistics for a specific domain

type EventResponse

type EventResponse struct {
	ID          int64     `json:"id"`
	UID         string    `json:"uid"`
	Summary     string    `json:"summary"`
	Description string    `json:"description,omitempty"`
	Location    string    `json:"location,omitempty"`
	StartTime   time.Time `json:"start_time"`
	EndTime     time.Time `json:"end_time"`
	AllDay      bool      `json:"all_day"`
	Timezone    string    `json:"timezone,omitempty"`
}

EventResponse represents an event for webmail

type LogEntry

type LogEntry struct {
	Timestamp string `json:"timestamp"`
	Level     string `json:"level"`
	Service   string `json:"service"`
	UserEmail string `json:"user_email,omitempty"`
	IPAddress string `json:"ip_address,omitempty"`
	Action    string `json:"action,omitempty"`
	Result    string `json:"result,omitempty"`
	Message   string `json:"message"`
}

LogEntry represents a log entry in API responses

type LogHandler

type LogHandler struct {
	// contains filtered or unexported fields
}

LogHandler handles log retrieval endpoints

func NewLogHandler

func NewLogHandler(auditService *service.AuditService, logger *zap.Logger) *LogHandler

NewLogHandler creates a new log handler

func (*LogHandler) List

func (h *LogHandler) List(w http.ResponseWriter, r *http.Request)

List retrieves logs with optional filtering

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	TOTPCode string `json:"totp_code,omitempty"`
}

LoginRequest represents a login request

type LoginResponse

type LoginResponse struct {
	Token        string    `json:"token"`
	RefreshToken string    `json:"refresh_token"`
	User         *UserInfo `json:"user"`
	ExpiresAt    time.Time `json:"expires_at"`
}

LoginResponse represents a login response

type LogsResponse

type LogsResponse struct {
	Logs       []LogEntry `json:"logs"`
	Page       int        `json:"page"`
	PageSize   int        `json:"page_size"`
	TotalPages int        `json:"total_pages"`
	TotalCount int        `json:"total_count"`
}

LogsResponse represents a paginated logs response

type MetricsTrendResponse

type MetricsTrendResponse struct {
	Metric     string            `json:"metric"`
	Domain     string            `json:"domain,omitempty"`
	IPAddress  string            `json:"ip_address,omitempty"`
	DataPoints []*TrendDataPoint `json:"data_points"`
	Trend      string            `json:"trend"`
	Change     float64           `json:"change"`
}

MetricsTrendResponse represents trend data for external metrics

type PGPHandler

type PGPHandler struct {
	// contains filtered or unexported fields
}

PGPHandler handles PGP key management endpoints

func NewPGPHandler

func NewPGPHandler(service *service.PGPService, logger *zap.Logger) *PGPHandler

NewPGPHandler creates a new PGP handler

func (*PGPHandler) DeleteKey

func (h *PGPHandler) DeleteKey(w http.ResponseWriter, r *http.Request)

DeleteKey deletes a PGP key

func (*PGPHandler) GetKey

func (h *PGPHandler) GetKey(w http.ResponseWriter, r *http.Request)

GetKey gets a specific PGP key

func (*PGPHandler) ImportKey

func (h *PGPHandler) ImportKey(w http.ResponseWriter, r *http.Request)

ImportKey imports a PGP public key for a user

func (*PGPHandler) ListKeys

func (h *PGPHandler) ListKeys(w http.ResponseWriter, r *http.Request)

ListKeys lists all PGP keys for a user

func (*PGPHandler) SetPrimary

func (h *PGPHandler) SetPrimary(w http.ResponseWriter, r *http.Request)

SetPrimary sets a key as the primary key for a user

type PGPKeyImportRequest

type PGPKeyImportRequest struct {
	UserID    int64  `json:"user_id"`
	PublicKey string `json:"public_key"`
}

PGPKeyImportRequest represents a request to import a PGP key

type PGPKeyResponse

type PGPKeyResponse struct {
	ID          int64  `json:"id"`
	UserID      int64  `json:"user_id"`
	KeyID       string `json:"key_id"`
	Fingerprint string `json:"fingerprint"`
	CreatedAt   string `json:"created_at"`
	UpdatedAt   string `json:"updated_at"`
	ExpiresAt   string `json:"expires_at,omitempty"`
	IsPrimary   bool   `json:"is_primary"`
}

PGPKeyResponse represents a PGP key in API responses

type PasswordResetRequest

type PasswordResetRequest struct {
	NewPassword string `json:"new_password"`
}

PasswordResetRequest represents a password reset request

type Phase5AlertResponse

type Phase5AlertResponse struct {
	ID             int64  `json:"id"`
	Domain         string `json:"domain"`
	AlertType      string `json:"alert_type"`
	Severity       string `json:"severity"`
	Title          string `json:"title"`
	Message        string `json:"message"`
	SourceType     string `json:"source_type"`
	SourceID       *int64 `json:"source_id,omitempty"`
	Acknowledged   bool   `json:"acknowledged"`
	AcknowledgedAt *int64 `json:"acknowledged_at,omitempty"`
	AcknowledgedBy string `json:"acknowledged_by,omitempty"`
	Resolved       bool   `json:"resolved"`
	ResolvedAt     *int64 `json:"resolved_at,omitempty"`
	CreatedAt      int64  `json:"created_at"`
}

Phase5AlertResponse represents a Phase 5 alert in API responses

type PostmasterMetricsResponse

type PostmasterMetricsResponse struct {
	ID                 int64   `json:"id"`
	Domain             string  `json:"domain"`
	Date               string  `json:"date"`
	SpamRate           float64 `json:"spam_rate"`
	IPReputation       string  `json:"ip_reputation"`
	DomainReputation   string  `json:"domain_reputation"`
	FeedbackLoopRate   float64 `json:"feedback_loop_rate"`
	AuthenticationRate float64 `json:"authentication_rate"`
	EncryptionRate     float64 `json:"encryption_rate"`
	DeliveryErrors     int     `json:"delivery_errors"`
	SyncedAt           int64   `json:"synced_at"`
}

PostmasterMetricsResponse represents Gmail Postmaster metrics in API responses

type PredictionResponse

type PredictionResponse struct {
	ID                 int64              `json:"id"`
	Domain             string             `json:"domain"`
	PredictionDate     string             `json:"prediction_date"`
	Horizon            string             `json:"horizon"`
	PredictedScore     int                `json:"predicted_score"`
	Confidence         float64            `json:"confidence"`
	PredictedBounce    float64            `json:"predicted_bounce"`
	PredictedComplaint float64            `json:"predicted_complaint"`
	TrendDirection     string             `json:"trend_direction"`
	RiskLevel          string             `json:"risk_level"`
	RecommendedActions []string           `json:"recommended_actions"`
	FeatureImportance  map[string]float64 `json:"feature_importance,omitempty"`
	GeneratedAt        int64              `json:"generated_at"`
}

PredictionResponse represents a reputation prediction in API responses

type ProcessInvitationRequest

type ProcessInvitationRequest struct {
	CalendarID  int64  `json:"calendar_id"`
	ICalData    string `json:"ical_data"`
	ResponseStr string `json:"response"` // "ACCEPTED", "TENTATIVE", "DECLINED"
}

ProcessInvitationRequest represents a calendar invitation response

type ProviderRateLimitResponse

type ProviderRateLimitResponse struct {
	ID                  int64  `json:"id"`
	Domain              string `json:"domain"`
	Provider            string `json:"provider"`
	MessagesPerHour     int    `json:"messages_per_hour"`
	MessagesPerDay      int    `json:"messages_per_day"`
	ConnectionsPerHour  int    `json:"connections_per_hour"`
	MaxRecipientsPerMsg int    `json:"max_recipients_per_msg"`
	CurrentUsageHour    int    `json:"current_usage_hour"`
	CurrentUsageDay     int    `json:"current_usage_day"`
	LastResetHour       int64  `json:"last_reset_hour"`
	LastResetDay        int64  `json:"last_reset_day"`
	UpdatedAt           int64  `json:"updated_at"`
}

ProviderRateLimitResponse represents a provider rate limit in API responses

type QueueHandler

type QueueHandler struct {
	// contains filtered or unexported fields
}

QueueHandler handles queue management endpoints

func NewQueueHandler

func NewQueueHandler(service *service.QueueService, logger *zap.Logger) *QueueHandler

NewQueueHandler creates a new queue handler

func (*QueueHandler) Delete

func (h *QueueHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete removes a queue item

func (*QueueHandler) Get

Get retrieves a specific queue item

func (*QueueHandler) List

func (h *QueueHandler) List(w http.ResponseWriter, r *http.Request)

List retrieves all queued messages with pagination and status filtering

func (*QueueHandler) Retry

func (h *QueueHandler) Retry(w http.ResponseWriter, r *http.Request)

Retry manually retries a failed queue item

type QueueItemResponse

type QueueItemResponse struct {
	ID           int64    `json:"id"`
	Sender       string   `json:"sender"`
	Recipients   []string `json:"recipients"`
	MessageID    string   `json:"message_id"`
	MessagePath  string   `json:"message_path"`
	Status       string   `json:"status"`
	RetryCount   int      `json:"retry_count"`
	MaxRetries   int      `json:"max_retries"`
	NextRetry    string   `json:"next_retry,omitempty"`
	ErrorMessage string   `json:"error_message,omitempty"`
	CreatedAt    string   `json:"created_at"`
	UpdatedAt    string   `json:"updated_at"`
}

QueueItemResponse represents a queued message in API responses

type QueueListResponse

type QueueListResponse struct {
	Items      []*QueueItemResponse `json:"items"`
	Page       int                  `json:"page"`
	PageSize   int                  `json:"page_size"`
	TotalPages int                  `json:"total_pages"`
	TotalCount int64                `json:"total_count"`
}

QueueListResponse represents a paginated list of queue items

type RefreshRequest

type RefreshRequest struct {
	RefreshToken string `json:"refresh_token"`
}

RefreshRequest represents a token refresh request

type ReputationHandler

type ReputationHandler struct {
	// contains filtered or unexported fields
}

ReputationHandler handles reputation management endpoints

func NewReputationHandler

func NewReputationHandler(
	auditorService *service.AuditorService,
	scoresRepo repository.ScoresRepository,
	eventsRepo repository.EventsRepository,
	circuitRepo repository.CircuitBreakerRepository,
	logger *zap.Logger,
) *ReputationHandler

NewReputationHandler creates a new reputation handler

func (*ReputationHandler) AuditDomain

func (h *ReputationHandler) AuditDomain(w http.ResponseWriter, r *http.Request)

AuditDomain performs a deliverability audit for a domain GET /api/v1/reputation/audit/:domain

func (*ReputationHandler) GetCircuitBreakerHistory

func (h *ReputationHandler) GetCircuitBreakerHistory(w http.ResponseWriter, r *http.Request)

GetCircuitBreakerHistory retrieves circuit breaker history for a domain GET /api/v1/reputation/circuit-breakers/:domain/history

func (*ReputationHandler) GetScore

func (h *ReputationHandler) GetScore(w http.ResponseWriter, r *http.Request)

GetScore retrieves reputation score for a specific domain GET /api/v1/reputation/scores/:domain

func (*ReputationHandler) ListAlerts

func (h *ReputationHandler) ListAlerts(w http.ResponseWriter, r *http.Request)

ListAlerts retrieves recent reputation alerts GET /api/v1/reputation/alerts

func (*ReputationHandler) ListCircuitBreakers

func (h *ReputationHandler) ListCircuitBreakers(w http.ResponseWriter, r *http.Request)

ListCircuitBreakers retrieves all active circuit breakers GET /api/v1/reputation/circuit-breakers

func (*ReputationHandler) ListScores

func (h *ReputationHandler) ListScores(w http.ResponseWriter, r *http.Request)

ListScores retrieves all domain reputation scores GET /api/v1/reputation/scores

type ReputationPhase5Handler

type ReputationPhase5Handler struct {
	// contains filtered or unexported fields
}

ReputationPhase5Handler handles Phase 5 reputation management endpoints (DMARC, ARF, external metrics, provider limits, custom warmup, predictions, alerts)

func NewReputationPhase5Handler

NewReputationPhase5Handler creates a new Phase 5 reputation handler

func (*ReputationPhase5Handler) AcknowledgeAlert

func (h *ReputationPhase5Handler) AcknowledgeAlert(w http.ResponseWriter, r *http.Request)

AcknowledgeAlert marks an alert as acknowledged POST /api/v1/reputation/alerts/:id/acknowledge

func (*ReputationPhase5Handler) CreateCustomWarmupSchedule

func (h *ReputationPhase5Handler) CreateCustomWarmupSchedule(w http.ResponseWriter, r *http.Request)

CreateCustomWarmupSchedule creates a new custom warmup schedule POST /api/v1/reputation/warmup

func (*ReputationPhase5Handler) DeleteCustomWarmupSchedule

func (h *ReputationPhase5Handler) DeleteCustomWarmupSchedule(w http.ResponseWriter, r *http.Request)

DeleteCustomWarmupSchedule deletes a warmup schedule DELETE /api/v1/reputation/warmup/:id

func (*ReputationPhase5Handler) ExportDMARCReport

func (h *ReputationPhase5Handler) ExportDMARCReport(w http.ResponseWriter, r *http.Request)

ExportDMARCReport exports a DMARC report in specified format POST /api/v1/reputation/dmarc/reports/:id/export

func (*ReputationPhase5Handler) GeneratePredictions

func (h *ReputationPhase5Handler) GeneratePredictions(w http.ResponseWriter, r *http.Request)

GeneratePredictions triggers prediction generation for a domain POST /api/v1/reputation/predictions/generate/:domain

func (*ReputationPhase5Handler) GetARFStats

func (h *ReputationPhase5Handler) GetARFStats(w http.ResponseWriter, r *http.Request)

GetARFStats retrieves ARF complaint statistics GET /api/v1/reputation/arf/stats

func (*ReputationPhase5Handler) GetCustomWarmupSchedule

func (h *ReputationPhase5Handler) GetCustomWarmupSchedule(w http.ResponseWriter, r *http.Request)

GetCustomWarmupSchedule retrieves the active warmup schedule for a domain GET /api/v1/reputation/warmup/:domain

func (*ReputationPhase5Handler) GetDMARCActions

func (h *ReputationPhase5Handler) GetDMARCActions(w http.ResponseWriter, r *http.Request)

GetDMARCActions retrieves auto-actions taken based on DMARC reports GET /api/v1/reputation/dmarc/actions

func (*ReputationPhase5Handler) GetDMARCReport

func (h *ReputationPhase5Handler) GetDMARCReport(w http.ResponseWriter, r *http.Request)

GetDMARCReport retrieves a specific DMARC report with all records GET /api/v1/reputation/dmarc/reports/:id

func (*ReputationPhase5Handler) GetDMARCStats

func (h *ReputationPhase5Handler) GetDMARCStats(w http.ResponseWriter, r *http.Request)

GetDMARCStats retrieves DMARC statistics for a domain GET /api/v1/reputation/dmarc/stats/:domain

func (*ReputationPhase5Handler) GetDomainPredictions

func (h *ReputationPhase5Handler) GetDomainPredictions(w http.ResponseWriter, r *http.Request)

GetDomainPredictions retrieves predictions for a specific domain GET /api/v1/reputation/predictions/:domain

func (*ReputationPhase5Handler) GetExternalMetricsTrends

func (h *ReputationPhase5Handler) GetExternalMetricsTrends(w http.ResponseWriter, r *http.Request)

GetExternalMetricsTrends retrieves trend analysis for external metrics GET /api/v1/reputation/external/trends

func (*ReputationPhase5Handler) GetLatestPredictions

func (h *ReputationPhase5Handler) GetLatestPredictions(w http.ResponseWriter, r *http.Request)

GetLatestPredictions retrieves the latest predictions for all domains GET /api/v1/reputation/predictions/latest

func (*ReputationPhase5Handler) GetPostmasterMetrics

func (h *ReputationPhase5Handler) GetPostmasterMetrics(w http.ResponseWriter, r *http.Request)

GetPostmasterMetrics retrieves Gmail Postmaster metrics for a domain GET /api/v1/reputation/external/postmaster/:domain

func (*ReputationPhase5Handler) GetPredictionHistory

func (h *ReputationPhase5Handler) GetPredictionHistory(w http.ResponseWriter, r *http.Request)

GetPredictionHistory retrieves historical predictions for a domain GET /api/v1/reputation/predictions/:domain/history

func (*ReputationPhase5Handler) GetSNDSMetrics

func (h *ReputationPhase5Handler) GetSNDSMetrics(w http.ResponseWriter, r *http.Request)

GetSNDSMetrics retrieves Microsoft SNDS metrics for an IP address GET /api/v1/reputation/external/snds/:ip

func (*ReputationPhase5Handler) GetWarmupTemplates

func (h *ReputationPhase5Handler) GetWarmupTemplates(w http.ResponseWriter, r *http.Request)

GetWarmupTemplates retrieves available warmup schedule templates GET /api/v1/reputation/warmup/templates

func (*ReputationPhase5Handler) InitializeProviderLimits

func (h *ReputationPhase5Handler) InitializeProviderLimits(w http.ResponseWriter, r *http.Request)

InitializeProviderLimits initializes rate limits for a domain POST /api/v1/reputation/provider-limits/init/:domain

func (*ReputationPhase5Handler) ListARFReports

func (h *ReputationPhase5Handler) ListARFReports(w http.ResponseWriter, r *http.Request)

ListARFReports retrieves ARF complaint reports with optional filters GET /api/v1/reputation/arf/reports

func (*ReputationPhase5Handler) ListDMARCReports

func (h *ReputationPhase5Handler) ListDMARCReports(w http.ResponseWriter, r *http.Request)

ListDMARCReports retrieves DMARC reports with optional filters GET /api/v1/reputation/dmarc/reports

func (*ReputationPhase5Handler) ListPhase5Alerts

func (h *ReputationPhase5Handler) ListPhase5Alerts(w http.ResponseWriter, r *http.Request)

ListPhase5Alerts retrieves all Phase 5 alerts with optional filters GET /api/v1/reputation/alerts/phase5

func (*ReputationPhase5Handler) ListProviderRateLimits

func (h *ReputationPhase5Handler) ListProviderRateLimits(w http.ResponseWriter, r *http.Request)

ListProviderRateLimits retrieves all provider-specific rate limits GET /api/v1/reputation/provider-limits

func (*ReputationPhase5Handler) ProcessARFReport

func (h *ReputationPhase5Handler) ProcessARFReport(w http.ResponseWriter, r *http.Request)

ProcessARFReport manually processes a specific ARF report POST /api/v1/reputation/arf/reports/:id/process

func (*ReputationPhase5Handler) ResetProviderUsage

func (h *ReputationPhase5Handler) ResetProviderUsage(w http.ResponseWriter, r *http.Request)

ResetProviderUsage resets usage counters for a provider limit POST /api/v1/reputation/provider-limits/:id/reset

func (*ReputationPhase5Handler) ResolveAlert

func (h *ReputationPhase5Handler) ResolveAlert(w http.ResponseWriter, r *http.Request)

ResolveAlert marks an alert as resolved POST /api/v1/reputation/alerts/:id/resolve

func (*ReputationPhase5Handler) UpdateCustomWarmupSchedule

func (h *ReputationPhase5Handler) UpdateCustomWarmupSchedule(w http.ResponseWriter, r *http.Request)

UpdateCustomWarmupSchedule updates an existing warmup schedule PUT /api/v1/reputation/warmup/:id

func (*ReputationPhase5Handler) UpdateProviderRateLimit

func (h *ReputationPhase5Handler) UpdateProviderRateLimit(w http.ResponseWriter, r *http.Request)

UpdateProviderRateLimit updates a provider rate limit PUT /api/v1/reputation/provider-limits/:id

type ReputationPhase6Handler

type ReputationPhase6Handler struct {
	// contains filtered or unexported fields
}

ReputationPhase6Handler handles Phase 6 WebUI endpoints

func NewReputationPhase6Handler

func NewReputationPhase6Handler(
	alertsRepo repository.AlertsRepository,
	scoresRepo repository.ScoresRepository,
	circuitBreakerRepo repository.CircuitBreakerRepository,
	logger *zap.Logger,
) *ReputationPhase6Handler

NewReputationPhase6Handler creates a new Phase 6 handler

func (*ReputationPhase6Handler) AcknowledgeAlert

func (h *ReputationPhase6Handler) AcknowledgeAlert(w http.ResponseWriter, r *http.Request)

AcknowledgeAlert acknowledges an alert POST /api/v1/reputation/alerts/:id/acknowledge

func (*ReputationPhase6Handler) DeleteOperationalMail

func (h *ReputationPhase6Handler) DeleteOperationalMail(w http.ResponseWriter, r *http.Request)

DeleteOperationalMail deletes an operational message DELETE /api/v1/reputation/operational-mail/:id

func (*ReputationPhase6Handler) ForwardOperationalMail

func (h *ReputationPhase6Handler) ForwardOperationalMail(w http.ResponseWriter, r *http.Request)

ForwardOperationalMail forwards operational message to another address POST /api/v1/reputation/operational-mail/:id/forward

func (*ReputationPhase6Handler) GetAlerts

GetAlerts returns alerts with filtering and pagination GET /api/v1/reputation/alerts

func (*ReputationPhase6Handler) GetCircuitBreakers

func (h *ReputationPhase6Handler) GetCircuitBreakers(w http.ResponseWriter, r *http.Request)

GetCircuitBreakers returns active and recent circuit breakers GET /api/v1/reputation/circuit-breakers GET /api/v1/reputation/circuit-breakers/:domain

func (*ReputationPhase6Handler) GetDeliverabilityStatus

func (h *ReputationPhase6Handler) GetDeliverabilityStatus(w http.ResponseWriter, r *http.Request)

GetDeliverabilityStatus returns comprehensive deliverability health GET /api/v1/reputation/deliverability GET /api/v1/reputation/deliverability/:domain

func (*ReputationPhase6Handler) GetOperationalMail

func (h *ReputationPhase6Handler) GetOperationalMail(w http.ResponseWriter, r *http.Request)

GetOperationalMail returns operational mailbox messages (postmaster@, abuse@) GET /api/v1/reputation/operational-mail

func (*ReputationPhase6Handler) GetUnreadAlertCount

func (h *ReputationPhase6Handler) GetUnreadAlertCount(w http.ResponseWriter, r *http.Request)

GetUnreadAlertCount returns count of unread alerts GET /api/v1/reputation/alerts/unread

func (*ReputationPhase6Handler) MarkAlertRead

func (h *ReputationPhase6Handler) MarkAlertRead(w http.ResponseWriter, r *http.Request)

MarkAlertRead marks an alert as read POST /api/v1/reputation/alerts/:id/read

func (*ReputationPhase6Handler) MarkOperationalMailRead

func (h *ReputationPhase6Handler) MarkOperationalMailRead(w http.ResponseWriter, r *http.Request)

MarkOperationalMailRead marks an operational message as read POST /api/v1/reputation/operational-mail/:id/read

func (*ReputationPhase6Handler) MarkOperationalMailSpam

func (h *ReputationPhase6Handler) MarkOperationalMailSpam(w http.ResponseWriter, r *http.Request)

MarkOperationalMailSpam marks message as spam and blocks sender POST /api/v1/reputation/operational-mail/:id/spam

func (*ReputationPhase6Handler) PauseCircuitBreaker

func (h *ReputationPhase6Handler) PauseCircuitBreaker(w http.ResponseWriter, r *http.Request)

PauseCircuitBreaker manually pauses a domain POST /api/v1/reputation/circuit-breakers/pause

func (*ReputationPhase6Handler) ResumeCircuitBreaker

func (h *ReputationPhase6Handler) ResumeCircuitBreaker(w http.ResponseWriter, r *http.Request)

ResumeCircuitBreaker manually resumes a paused domain POST /api/v1/reputation/circuit-breakers/:id/resume

func (*ReputationPhase6Handler) SetAuditorService

func (h *ReputationPhase6Handler) SetAuditorService(auditor *reputationService.AuditorService)

SetAuditorService sets the auditor service for DNS health checks

func (*ReputationPhase6Handler) SetHistoricalScoresRepo

func (h *ReputationPhase6Handler) SetHistoricalScoresRepo(repo repository.HistoricalScoresRepository)

SetHistoricalScoresRepo sets the historical scores repository for trend calculation

func (*ReputationPhase6Handler) SetServices

func (h *ReputationPhase6Handler) SetServices(
	userService *service.UserService,
	mailboxService *service.MailboxService,
	messageService *service.MessageService,
	queueService *service.QueueService,
)

SetServices sets the service dependencies for operational mail access

type SNDSMetricsResponse

type SNDSMetricsResponse struct {
	ID            int64   `json:"id"`
	IPAddress     string  `json:"ip_address"`
	Date          string  `json:"date"`
	MessageCount  int     `json:"message_count"`
	FilterResult  string  `json:"filter_result"`
	ComplaintRate float64 `json:"complaint_rate"`
	TrapHits      int     `json:"trap_hits"`
	SampleData    int     `json:"sample_data"`
	RCPT          int     `json:"rcpt"`
	SyncedAt      int64   `json:"synced_at"`
}

SNDSMetricsResponse represents Microsoft SNDS metrics in API responses

type ScoreResponse

type ScoreResponse struct {
	Domain               string  `json:"domain"`
	ReputationScore      int     `json:"reputation_score"`
	ComplaintRate        float64 `json:"complaint_rate"`
	BounceRate           float64 `json:"bounce_rate"`
	DeliveryRate         float64 `json:"delivery_rate"`
	CircuitBreakerActive bool    `json:"circuit_breaker_active"`
	CircuitBreakerReason string  `json:"circuit_breaker_reason,omitempty"`
	WarmUpActive         bool    `json:"warm_up_active"`
	WarmUpDay            int     `json:"warm_up_day,omitempty"`
	LastUpdated          int64   `json:"last_updated"`
}

ScoreResponse represents a reputation score in API responses

type SettingsHandler

type SettingsHandler struct {
	// contains filtered or unexported fields
}

SettingsHandler handles settings-related API endpoints

func NewSettingsHandler

func NewSettingsHandler(service *service.SettingsService, logger *zap.Logger) *SettingsHandler

NewSettingsHandler creates a new settings handler instance

func (*SettingsHandler) GetSecurity

func (h *SettingsHandler) GetSecurity(w http.ResponseWriter, r *http.Request)

GetSecurity retrieves current security configuration

func (*SettingsHandler) GetServer

func (h *SettingsHandler) GetServer(w http.ResponseWriter, r *http.Request)

GetServer retrieves current server configuration

func (*SettingsHandler) GetTLS

func (h *SettingsHandler) GetTLS(w http.ResponseWriter, r *http.Request)

GetTLS retrieves current TLS/certificate configuration

func (*SettingsHandler) UpdateSecurity

func (h *SettingsHandler) UpdateSecurity(w http.ResponseWriter, r *http.Request)

UpdateSecurity updates security configuration

func (*SettingsHandler) UpdateServer

func (h *SettingsHandler) UpdateServer(w http.ResponseWriter, r *http.Request)

UpdateServer updates server configuration

func (*SettingsHandler) UpdateTLS

func (h *SettingsHandler) UpdateTLS(w http.ResponseWriter, r *http.Request)

UpdateTLS updates TLS/certificate configuration

type SetupHandler

type SetupHandler struct {
	// contains filtered or unexported fields
}

SetupHandler handles setup wizard endpoints

func NewSetupHandler

func NewSetupHandler(setupService *service.SetupService, logger *zap.Logger) *SetupHandler

NewSetupHandler creates a new setup handler

func (*SetupHandler) CompleteSetup

func (h *SetupHandler) CompleteSetup(w http.ResponseWriter, r *http.Request)

CompleteSetup marks the setup wizard as complete

func (*SetupHandler) CreateAdmin

func (h *SetupHandler) CreateAdmin(w http.ResponseWriter, r *http.Request)

CreateAdmin creates the first admin user

func (*SetupHandler) GetState

func (h *SetupHandler) GetState(w http.ResponseWriter, r *http.Request)

GetState returns the full setup wizard state

func (*SetupHandler) GetStatus

func (h *SetupHandler) GetStatus(w http.ResponseWriter, r *http.Request)

GetStatus returns the current setup status

type StatsHandler

type StatsHandler struct {
	// contains filtered or unexported fields
}

StatsHandler handles statistics and monitoring endpoints

func NewStatsHandler

func NewStatsHandler(
	domainService *service.DomainService,
	userService *service.UserService,
	queueService *service.QueueService,
	aliasService *service.AliasService,
	logger *zap.Logger,
) *StatsHandler

NewStatsHandler creates a new statistics handler

func (*StatsHandler) Dashboard

func (h *StatsHandler) Dashboard(w http.ResponseWriter, r *http.Request)

Dashboard retrieves dashboard statistics

func (*StatsHandler) Domain

func (h *StatsHandler) Domain(w http.ResponseWriter, r *http.Request)

Domain retrieves statistics for a specific domain

func (*StatsHandler) User

func (h *StatsHandler) User(w http.ResponseWriter, r *http.Request)

User retrieves statistics for a specific user

type StatusResponse

type StatusResponse struct {
	SetupComplete bool   `json:"setup_complete"`
	CurrentStep   string `json:"current_step,omitempty"`
}

StatusResponse represents the setup status response

type SystemHealthStatus

type SystemHealthStatus struct {
	Status         string  `json:"status"` // "healthy", "degraded", "critical"
	DatabaseStatus string  `json:"database_status"`
	SMTPStatus     string  `json:"smtp_status"`
	IMAPStatus     string  `json:"imap_status"`
	QueueDepth     int64   `json:"queue_depth"`
	QueueHealthy   bool    `json:"queue_healthy"`
	DiskUsage      float64 `json:"disk_usage_percent"`
	MemoryUsage    float64 `json:"memory_usage_percent"`
	CPUUsage       float64 `json:"cpu_usage_percent"`
	UptimeSeconds  int64   `json:"uptime_seconds"`
}

SystemHealthStatus represents system health indicators

type TrendDataPoint

type TrendDataPoint struct {
	Date  string  `json:"date"`
	Value float64 `json:"value"`
}

TrendDataPoint represents a single data point in a trend

type TrendResult

type TrendResult struct {
	Direction      string  // "improving", "stable", "declining"
	ChangePercent  float64 // Percentage change over period
	PeriodDays     int     // Number of days analyzed
	PreviousScore  int     // Score at start of period
	DataPoints     int     // Number of data points used
	ConfidenceNote string  // Note about confidence level
}

TrendResult represents the calculated reputation trend

type UserHandler

type UserHandler struct {
	// contains filtered or unexported fields
}

UserHandler handles user management endpoints

func NewUserHandler

func NewUserHandler(service *service.UserService, logger *zap.Logger) *UserHandler

NewUserHandler creates a new user handler

func (*UserHandler) Create

func (h *UserHandler) Create(w http.ResponseWriter, r *http.Request)

Create creates a new user

func (*UserHandler) Delete

func (h *UserHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete deletes a user

func (*UserHandler) Get

func (h *UserHandler) Get(w http.ResponseWriter, r *http.Request)

Get retrieves a specific user

func (*UserHandler) List

func (h *UserHandler) List(w http.ResponseWriter, r *http.Request)

List retrieves users with pagination and optional domain filtering

func (*UserHandler) ResetPassword

func (h *UserHandler) ResetPassword(w http.ResponseWriter, r *http.Request)

ResetPassword resets a user's password

func (*UserHandler) Update

func (h *UserHandler) Update(w http.ResponseWriter, r *http.Request)

Update updates a user

type UserInfo

type UserInfo struct {
	ID          int64  `json:"id"`
	Email       string `json:"email"`
	FullName    string `json:"full_name"`
	Role        string `json:"role"`
	DomainID    int64  `json:"domain_id"`
	DomainName  string `json:"domain_name"`
	TOTPEnabled bool   `json:"totp_enabled"`
}

UserInfo represents user information in responses

type UserListResponse

type UserListResponse struct {
	Users      []*UserResponse `json:"users"`
	Page       int             `json:"page"`
	PageSize   int             `json:"page_size"`
	TotalPages int             `json:"total_pages"`
	TotalCount int64           `json:"total_count"`
}

UserListResponse represents a paginated list of users

type UserRequest

type UserRequest struct {
	Email            string  `json:"email"`
	Password         string  `json:"password,omitempty"`
	FullName         string  `json:"full_name"`
	DisplayName      string  `json:"display_name,omitempty"`
	DomainID         int64   `json:"domain_id"`
	Quota            int64   `json:"quota,omitempty"`
	Status           string  `json:"status,omitempty"`
	ForwardTo        string  `json:"forward_to,omitempty"`
	AutoReplyEnabled bool    `json:"auto_reply_enabled"`
	AutoReplySubject string  `json:"auto_reply_subject,omitempty"`
	AutoReplyBody    string  `json:"auto_reply_body,omitempty"`
	SpamThreshold    float64 `json:"spam_threshold,omitempty"`
}

UserRequest represents a user creation/update request

type UserResponse

type UserResponse struct {
	ID               int64   `json:"id"`
	Email            string  `json:"email"`
	FullName         string  `json:"full_name"`
	DisplayName      string  `json:"display_name,omitempty"`
	DomainID         int64   `json:"domain_id"`
	DomainName       string  `json:"domain_name,omitempty"`
	Quota            int64   `json:"quota"`
	UsedQuota        int64   `json:"used_quota"`
	Status           string  `json:"status"`
	ForwardTo        string  `json:"forward_to,omitempty"`
	AutoReplyEnabled bool    `json:"auto_reply_enabled"`
	AutoReplySubject string  `json:"auto_reply_subject,omitempty"`
	AutoReplyBody    string  `json:"auto_reply_body,omitempty"`
	SpamThreshold    float64 `json:"spam_threshold"`
	TOTPEnabled      bool    `json:"totp_enabled"`
	CreatedAt        string  `json:"created_at"`
	LastLogin        string  `json:"last_login,omitempty"`
}

UserResponse represents a user in API responses

type UserStat

type UserStat struct {
	UserID       int64   `json:"user_id"`
	Email        string  `json:"email"`
	StorageUsed  int64   `json:"storage_used"`
	MessageCount int64   `json:"message_count"`
	QuotaPercent float64 `json:"quota_percent"`
}

UserStat represents user statistics

type UserStats

type UserStats struct {
	UserID            int64   `json:"user_id"`
	Email             string  `json:"email"`
	DomainID          int64   `json:"domain_id"`
	DomainName        string  `json:"domain_name"`
	Status            string  `json:"status"`
	StorageUsed       int64   `json:"storage_used"`
	StorageQuota      int64   `json:"storage_quota"`
	QuotaPercent      float64 `json:"quota_percent"`
	TotalMessages     int64   `json:"total_messages"`
	MessagesToday     int64   `json:"messages_today"`
	MessagesThisWeek  int64   `json:"messages_this_week"`
	MessagesThisMonth int64   `json:"messages_this_month"`
	LastLogin         string  `json:"last_login,omitempty"`
	CreatedAt         string  `json:"created_at"`
}

UserStats represents statistics for a specific user

type WarmupDayLimit

type WarmupDayLimit struct {
	Day          int `json:"day"`
	MessageLimit int `json:"message_limit"`
}

WarmupDayLimit represents a daily limit in a warmup schedule

type WebhookHandler

type WebhookHandler struct {
	// contains filtered or unexported fields
}

WebhookHandler handles webhook-related API requests

func NewWebhookHandler

func NewWebhookHandler(service *service.WebhookService, logger *zap.Logger) *WebhookHandler

NewWebhookHandler creates a new webhook handler

func (*WebhookHandler) CreateWebhook

func (h *WebhookHandler) CreateWebhook(w http.ResponseWriter, r *http.Request)

CreateWebhook handles POST /api/v1/webhooks

func (*WebhookHandler) DeleteWebhook

func (h *WebhookHandler) DeleteWebhook(w http.ResponseWriter, r *http.Request)

DeleteWebhook handles DELETE /api/v1/webhooks/{id}

func (*WebhookHandler) GetDelivery

func (h *WebhookHandler) GetDelivery(w http.ResponseWriter, r *http.Request)

GetDelivery handles GET /api/v1/webhooks/deliveries/{id}

func (*WebhookHandler) GetWebhook

func (h *WebhookHandler) GetWebhook(w http.ResponseWriter, r *http.Request)

GetWebhook handles GET /api/v1/webhooks/{id}

func (*WebhookHandler) ListDeliveries

func (h *WebhookHandler) ListDeliveries(w http.ResponseWriter, r *http.Request)

ListDeliveries handles GET /api/v1/webhooks/{id}/deliveries

func (*WebhookHandler) ListWebhooks

func (h *WebhookHandler) ListWebhooks(w http.ResponseWriter, r *http.Request)

ListWebhooks handles GET /api/v1/webhooks

func (*WebhookHandler) TestWebhook

func (h *WebhookHandler) TestWebhook(w http.ResponseWriter, r *http.Request)

TestWebhook handles POST /api/v1/webhooks/{id}/test

func (*WebhookHandler) UpdateWebhook

func (h *WebhookHandler) UpdateWebhook(w http.ResponseWriter, r *http.Request)

UpdateWebhook handles PUT /api/v1/webhooks/{id}

type WebmailCalendarHandler

type WebmailCalendarHandler struct {
	// contains filtered or unexported fields
}

WebmailCalendarHandler handles webmail calendar operations

func NewWebmailCalendarHandler

func NewWebmailCalendarHandler(
	calendarSvc *calendarService.CalendarService,
	eventSvc *calendarService.EventService,
	logger *zap.Logger,
) *WebmailCalendarHandler

NewWebmailCalendarHandler creates a new webmail calendar handler

func (*WebmailCalendarHandler) CreateEvent

func (h *WebmailCalendarHandler) CreateEvent(w http.ResponseWriter, r *http.Request)

CreateEvent creates a new calendar event from webmail POST /api/v1/webmail/calendar/events

func (*WebmailCalendarHandler) GetUpcomingEvents

func (h *WebmailCalendarHandler) GetUpcomingEvents(w http.ResponseWriter, r *http.Request)

GetUpcomingEvents gets upcoming events across all calendars GET /api/v1/webmail/calendar/upcoming?days=7

func (*WebmailCalendarHandler) ListCalendars

func (h *WebmailCalendarHandler) ListCalendars(w http.ResponseWriter, r *http.Request)

ListCalendars lists user's calendars GET /api/v1/webmail/calendar/calendars

func (*WebmailCalendarHandler) ProcessInvitation

func (h *WebmailCalendarHandler) ProcessInvitation(w http.ResponseWriter, r *http.Request)

ProcessInvitation processes a calendar invitation (accept/decline/tentative) POST /api/v1/webmail/calendar/invitations

type WebmailContactsHandler

type WebmailContactsHandler struct {
	// contains filtered or unexported fields
}

WebmailContactsHandler handles webmail contact operations

func NewWebmailContactsHandler

func NewWebmailContactsHandler(
	contactSvc *contactService.ContactService,
	addressbookSvc *contactService.AddressbookService,
	logger *zap.Logger,
) *WebmailContactsHandler

NewWebmailContactsHandler creates a new webmail contacts handler

func (*WebmailContactsHandler) ListAddressbooks

func (h *WebmailContactsHandler) ListAddressbooks(w http.ResponseWriter, r *http.Request)

ListAddressbooks lists user's addressbooks GET /api/v1/webmail/contacts/addressbooks

func (*WebmailContactsHandler) ListContacts

func (h *WebmailContactsHandler) ListContacts(w http.ResponseWriter, r *http.Request)

ListContacts lists contacts in an addressbook GET /api/v1/webmail/contacts/addressbooks/{id}/contacts

func (*WebmailContactsHandler) SearchContacts

func (h *WebmailContactsHandler) SearchContacts(w http.ResponseWriter, r *http.Request)

SearchContacts handles contact autocomplete/search for composer GET /api/v1/webmail/contacts/search?q=john

type WebmailHandler

type WebmailHandler struct {
	// contains filtered or unexported fields
}

WebmailHandler handles webmail-related HTTP requests

func NewWebmailHandler

func NewWebmailHandler(
	mailboxService *service.MailboxService,
	messageService *service.MessageService,
	phishingService *phishing.PhishingDetectionService,
	logger *zap.Logger,
) *WebmailHandler

NewWebmailHandler creates a new webmail handler

func (*WebmailHandler) AnalyzePhishing

func (h *WebmailHandler) AnalyzePhishing(w http.ResponseWriter, r *http.Request)

AnalyzePhishing handles POST /api/v1/webmail/messages/:id/phishing

func (*WebmailHandler) CompleteTask

func (h *WebmailHandler) CompleteTask(w http.ResponseWriter, r *http.Request)

CompleteTask handles POST /api/v1/webmail/messages/:id/complete

func (*WebmailHandler) DeleteDraft

func (h *WebmailHandler) DeleteDraft(w http.ResponseWriter, r *http.Request)

DeleteDraft handles DELETE /api/v1/webmail/drafts/:id

func (*WebmailHandler) DeleteMessage

func (h *WebmailHandler) DeleteMessage(w http.ResponseWriter, r *http.Request)

DeleteMessage handles DELETE /api/v1/webmail/messages/:id

func (*WebmailHandler) DownloadAttachment

func (h *WebmailHandler) DownloadAttachment(w http.ResponseWriter, r *http.Request)

DownloadAttachment handles GET /api/v1/webmail/attachments/:id

func (*WebmailHandler) GetDraft

func (h *WebmailHandler) GetDraft(w http.ResponseWriter, r *http.Request)

GetDraft handles GET /api/v1/webmail/drafts/:id

func (*WebmailHandler) GetMessage

func (h *WebmailHandler) GetMessage(w http.ResponseWriter, r *http.Request)

GetMessage handles GET /api/v1/webmail/messages/:id

func (*WebmailHandler) ListDrafts

func (h *WebmailHandler) ListDrafts(w http.ResponseWriter, r *http.Request)

ListDrafts handles GET /api/v1/webmail/drafts

func (*WebmailHandler) ListMailboxes

func (h *WebmailHandler) ListMailboxes(w http.ResponseWriter, r *http.Request)

ListMailboxes handles GET /api/v1/webmail/mailboxes

func (*WebmailHandler) ListMessages

func (h *WebmailHandler) ListMessages(w http.ResponseWriter, r *http.Request)

ListMessages handles GET /api/v1/webmail/mailboxes/:id/messages

func (*WebmailHandler) MoveMessage

func (h *WebmailHandler) MoveMessage(w http.ResponseWriter, r *http.Request)

MoveMessage handles POST /api/v1/webmail/messages/:id/move

func (*WebmailHandler) SaveDraft

func (h *WebmailHandler) SaveDraft(w http.ResponseWriter, r *http.Request)

SaveDraft handles POST /api/v1/webmail/drafts

func (*WebmailHandler) SearchMessages

func (h *WebmailHandler) SearchMessages(w http.ResponseWriter, r *http.Request)

SearchMessages handles GET /api/v1/webmail/search

func (*WebmailHandler) SendMessage

func (h *WebmailHandler) SendMessage(w http.ResponseWriter, r *http.Request)

SendMessage handles POST /api/v1/webmail/messages

func (*WebmailHandler) UpdateFlags

func (h *WebmailHandler) UpdateFlags(w http.ResponseWriter, r *http.Request)

UpdateFlags handles POST /api/v1/webmail/messages/:id/flags

Jump to

Keyboard shortcuts

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