http
import "github.com/prescriptoo/prescriptoo-api/services/subscription/internal/presentation/http"Package http provides HTTP/REST presentation handlers. Legacy prototype definitions in this file are unmounted; production uses the billing implementation.
Index
- type BillingHandler
- type Handler
- func NewHandler(createPlanUC *usecase.CreatePlanUseCase, listPlansUC *usecase.ListPlansUseCase, subscribeUC *usecase.SubscribeUseCase, getSubUC *usecase.GetSubscriptionUseCase, cancelSubUC *usecase.CancelSubscriptionUseCase) *Handler
- func (h *Handler) CancelSubscription(ctx context.Context, w http.ResponseWriter, id string)
- func (h *Handler) CreatePlan(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetSubscription(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListPlans(ctx context.Context, w http.ResponseWriter)
- func (h *Handler) RegisterRoutes(mux *http.ServeMux)
- func (h *Handler) Subscribe(ctx context.Context, w http.ResponseWriter, r *http.Request)
type BillingHandler
BillingHandler serves persistent billing operations.
type BillingHandler struct {
ListPublicPlans *usecase.ListPublicPlansUseCase
GetPublicPlan *usecase.GetPublicPlanUseCase
}func NewBillingHandler
func NewBillingHandler(billing ...*usecase.Billing) *BillingHandlerNewBillingHandler wires public offerings to subscription-owned catalog use cases.
func (*BillingHandler) RegisterHuma
func (h *BillingHandler) RegisterHuma(api huma.API)RegisterHuma publishes validated billing contracts and implemented lifecycle responses.
type Handler
Handler wraps use cases for HTTP delivery.
type Handler struct {
// contains filtered or unexported fields
}func NewHandler
func NewHandler(createPlanUC *usecase.CreatePlanUseCase, listPlansUC *usecase.ListPlansUseCase, subscribeUC *usecase.SubscribeUseCase, getSubUC *usecase.GetSubscriptionUseCase, cancelSubUC *usecase.CancelSubscriptionUseCase) *HandlerNewHandler creates a new HTTP handler instance.
func (*Handler) CancelSubscription
func (h *Handler) CancelSubscription(ctx context.Context, w http.ResponseWriter, id string)CancelSubscription cancels the subscription identified by id and writes an acknowledgment.
func (*Handler) CreatePlan
func (h *Handler) CreatePlan(ctx context.Context, w http.ResponseWriter, r *http.Request)CreatePlan creates a subscription plan from the request and writes its details.
func (*Handler) GetSubscription
func (h *Handler) GetSubscription(ctx context.Context, w http.ResponseWriter, r *http.Request)GetSubscription writes the subscription for the organization specified in the query.
func (*Handler) ListPlans
func (h *Handler) ListPlans(ctx context.Context, w http.ResponseWriter)ListPlans writes all public subscription plans.
func (*Handler) RegisterRoutes
func (h *Handler) RegisterRoutes(mux *http.ServeMux)RegisterRoutes registers HTTP routes on the given ServeMux.
func (*Handler) Subscribe
func (h *Handler) Subscribe(ctx context.Context, w http.ResponseWriter, r *http.Request)Subscribe creates an organization's subscription from the request and writes its details.
Generated by gomarkdoc