Skip to content

http ​

go
import "github.com/prescriptoo/prescriptoo-api/services/notification/internal/presentation/http"

Package http provides HTTP/REST presentation handlers.

Index ​

type Handler ​

Handler wraps use cases for HTTP delivery.

go
type Handler struct {
    // contains filtered or unexported fields
}

func NewHandler ​

go
func NewHandler(sendNotificationUC *usecase.SendNotificationUseCase, getNotificationUC *usecase.GetNotificationUseCase, listNotificationsUC *usecase.ListNotificationsUseCase, createTemplateUC *usecase.CreateTemplateUseCase, listTemplatesUC *usecase.ListTemplatesUseCase, getTemplateUC *usecase.GetTemplateUseCase, updateTemplateUC *usecase.UpdateTemplateUseCase) *Handler

NewHandler creates a new HTTP handler instance.

func (*Handler) CreateTemplate ​

go
func (h *Handler) CreateTemplate(ctx context.Context, w http.ResponseWriter, r *http.Request)

CreateTemplate creates a notification template from the request and writes its details.

func (*Handler) GetNotification ​

go
func (h *Handler) GetNotification(ctx context.Context, w http.ResponseWriter, id string)

GetNotification writes the notification identified by id.

func (*Handler) GetTemplate ​

go
func (h *Handler) GetTemplate(ctx context.Context, w http.ResponseWriter, id string)

GetTemplate writes the notification template identified by id.

func (*Handler) ListNotifications ​

go
func (h *Handler) ListNotifications(ctx context.Context, w http.ResponseWriter, r *http.Request)

ListNotifications writes notifications for the recipient specified in the query.

func (*Handler) ListTemplates ​

go
func (h *Handler) ListTemplates(ctx context.Context, w http.ResponseWriter)

ListTemplates writes all notification templates.

func (*Handler) RegisterRoutes ​

go
func (h *Handler) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes registers HTTP routes on the given ServeMux.

func (*Handler) SendNotification ​

go
func (h *Handler) SendNotification(ctx context.Context, w http.ResponseWriter, r *http.Request)

SendNotification processes a notification request and writes the resulting record.

func (*Handler) UpdateTemplate ​

go
func (h *Handler) UpdateTemplate(ctx context.Context, w http.ResponseWriter, r *http.Request)

UpdateTemplate updates the template identified in the request and writes its details.

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.