router/prototype.go
2024-10-09 00:15:18 -04:00

39 lines
783 B
Go

package router
import "io"
type RequestBuilder interface {
Prototype() (req PrototypeRequestBuilder)
Allowed(method string) (errRes ErrorResponse)
Header(header Header) (errRes ErrorResponse)
ReadBody(body io.ReadCloser) (errRes ErrorResponse)
Values(values Values) (errRes ErrorResponse)
}
type PrototypeRequestBuilder interface {
RequestBuilder() (req RequestBuilder)
}
type Response interface {
Prototype() (req PrototypeResponse)
Header() (header Header)
BodyBytes() (body []byte)
}
type PrototypeResponse interface {
Response() (res Response)
}
type ErrorResponse interface {
Ok() (ok bool)
HttpStatus() (code int)
BodyBytes() (body []byte)
String() (out string)
Error() (out string)
}
type Prototype struct {
PrototypeRequestBuilder
PrototypeResponse
}