Documentation
¶
Overview ¶
Package adapters provides infrastructure adapters for the notification feature.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient implements ports.Service by calling a remote notification service over HTTP. It demonstrates how a standalone process can consume a feature without importing its implementation.
func NewHTTPClient ¶
func NewHTTPClient(baseURL string, client *http.Client) (*HTTPClient, error)
NewHTTPClient creates a remote notification client.
baseURL must be a non-empty string. If client is nil, http.DefaultClient is used.
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer exposes the notification service over HTTP. It keeps HTTP concerns (encoding, status codes) separate from business logic.
func NewHTTPServer ¶
func NewHTTPServer(svc ports.Service, logger *slog.Logger) *HTTPServer
NewHTTPServer creates an HTTP adapter for the notification service.
func (*HTTPServer) SendHandler ¶
func (s *HTTPServer) SendHandler() http.HandlerFunc
SendHandler returns an http.HandlerFunc that forwards requests to the notification service.
type SendRequest ¶
type SendRequest struct {
Message string `json:"message"`
}
SendRequest is the JSON body accepted by the send endpoint.
type SendResponse ¶
type SendResponse struct {
Status string `json:"status"`
}
SendResponse is the JSON body returned by the send endpoint.