20 lines
521 B
Go
20 lines
521 B
Go
|
|
package contract
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Response is the transport-neutral result produced by the customer-service
|
||
|
|
// module before the host application renders its HTTP response envelope.
|
||
|
|
type Response struct {
|
||
|
|
StatusCode int
|
||
|
|
ErrorCode int
|
||
|
|
Message string
|
||
|
|
Data any
|
||
|
|
Success bool
|
||
|
|
}
|
||
|
|
|
||
|
|
// ResponseWriter lets the host application render module responses with the
|
||
|
|
// exact same response and error contract used by its own APIs.
|
||
|
|
type ResponseWriter func(http.ResponseWriter, *http.Request, Response) error
|