Skip to content

http ​

go
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 ​

BillingHandler serves persistent billing operations.

go
type BillingHandler struct {
    ListPublicPlans *usecase.ListPublicPlansUseCase
    GetPublicPlan   *usecase.GetPublicPlanUseCase
}

func NewBillingHandler ​

go
func NewBillingHandler(billing ...*usecase.Billing) *BillingHandler

NewBillingHandler wires public offerings to subscription-owned catalog use cases.

func (*BillingHandler) RegisterHuma ​

go
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.

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

func NewHandler ​

go
func NewHandler(createPlanUC *usecase.CreatePlanUseCase, listPlansUC *usecase.ListPlansUseCase, subscribeUC *usecase.SubscribeUseCase, getSubUC *usecase.GetSubscriptionUseCase, cancelSubUC *usecase.CancelSubscriptionUseCase) *Handler

NewHandler creates a new HTTP handler instance.

func (*Handler) CancelSubscription ​

go
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 ​

go
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 ​

go
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 ​

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

ListPlans writes all public subscription plans.

func (*Handler) RegisterRoutes ​

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

RegisterRoutes registers HTTP routes on the given ServeMux.

func (*Handler) Subscribe ​

go
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

Documentation follows the source. Planned contracts are marked explicitly.