router/prototype.go

42 lines
705 B
Go
Raw Normal View History

2024-10-07 21:39:42 +00:00
package router
import "io"
2024-10-08 21:57:25 +00:00
type RequestBuilder interface {
2024-10-07 21:39:42 +00:00
Allowed(method string) ErrorResponse
2024-10-08 21:57:25 +00:00
Header(Header) ErrorResponse
Body(body io.ReadCloser) ErrorResponse
Values(values Values) ErrorResponse
2024-10-07 21:39:42 +00:00
}
2024-10-08 21:57:25 +00:00
type PrototypeRequestBuilder interface {
RequestBuilder() RequestBuilder
2024-10-07 21:39:42 +00:00
}
type Response interface {
Header() Header
Response() (body []byte)
}
type PrototypeResponse interface {
Response() Response
}
type ErrorResponse interface {
Ok() bool
HttpStatus() int
ErrorResponse() []byte
String() string
2024-10-07 22:14:34 +00:00
Error() string
2024-10-07 21:39:42 +00:00
}
type PrototypeErrorResponse interface {
ErrorResponse() ErrorResponse
}
type Prototype struct {
2024-10-08 21:57:25 +00:00
PrototypeRequestBuilder
2024-10-07 21:39:42 +00:00
PrototypeResponse
PrototypeErrorResponse
}