mail

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mail is a package that contains the mail controller

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRoutes

func SetupRoutes(router *gin.Engine, database *mongo.Database)

SetupRoutes sets up the mail routes

func SetupRoutesWithMock

func SetupRoutesWithMock(router *gin.Engine, mailRepo repositories.MailRepositoryInterface)

SetupRoutesWithMock sets up the mail routes with a mock repository for testing

Types

type Controller

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

Controller handles mail related operations

func NewMailController

func NewMailController(mailRepo repositories.MailRepositoryInterface) *Controller

NewMailController creates a new mail controller instance

func (*Controller) CleanupTrash

func (c *Controller) CleanupTrash(ctx *gin.Context)

CleanupTrash cleans up trash mails for the authenticated user

func (*Controller) GetAllMails

func (c *Controller) GetAllMails(ctx *gin.Context)

GetAllMails retrieves all mails for the authenticated user with pagination @Summary Get all mails @Description Get all mails for the authenticated user with pagination @Tags Mail @Produce json @Param page query int false "Page number (default: 1)" @Param size query int false "Number of items per page (default: 10, max: 100)" @Success 200 {object} PaginatedMailResponse @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail [get]

func (*Controller) GetMailByID

func (c *Controller) GetMailByID(ctx *gin.Context)

GetMailByID retrieves a mail by its ID for the authenticated user @Summary Get mail by ID @Description Get a specific mail by its ID for the authenticated user @Tags Mail @Produce json @Param id path string true "Mail ID" @Success 200 {object} models.Mail @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/{id} [get]

func (*Controller) GetMailsSince added in v0.3.0

func (c *Controller) GetMailsSince(ctx *gin.Context)

GetMailsSince retrieves mails updated since a specific date for the authenticated user with pagination @Summary Get mails updated since date @Description Get mails updated since a specific date for the authenticated user with pagination @Tags Mail @Produce json @Param since query string true "Date in ISO8601 format (e.g., 2024-01-01T00:00:00Z)" @Param page query int false "Page number (default: 1)" @Param size query int false "Number of items per page (default: 10, max: 100)" @Success 200 {object} PaginatedMailResponse @Failure 401 {object} map[string]interface{} @Failure 400 {object} map[string]interface{} @Failure 500 {object} map[string]interface{} @Router /mail/since [get]

func (*Controller) PutMailActions

func (c *Controller) PutMailActions(ctx *gin.Context)

PutMailActions updates the actions of a mail

type PaginatedMailResponse

type PaginatedMailResponse struct {
	Mails      []*models.Mail `json:"mails"`
	TotalCount int64          `json:"total_count"`
	Page       int64          `json:"page"`
	Size       int64          `json:"size"`
	TotalPages int64          `json:"total_pages"`
}

PaginatedMailResponse represents the paginated response for mails

type PutActionsPayload

type PutActionsPayload struct {
	Read       []string `json:"read,omitempty"`
	Unread     []string `json:"unread,omitempty"`
	Archived   []string `json:"archived,omitempty"`
	Unarchived []string `json:"unarchived,omitempty"`
	Trashed    []string `json:"trashed,omitempty"`
	Untrashed  []string `json:"untrashed,omitempty"`
}

PutActionsPayload represents the request payload for updating mail actions

Jump to

Keyboard shortcuts

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