router/prototype.go

42 lines
819 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 {
Allowed(method string) (errRes ErrorResponse)
Header(header Header) (errRes ErrorResponse)
Body(body io.ReadCloser) (errRes ErrorResponse)
Values(values Values) (errRes ErrorResponse)
2024-10-07 21:39:42 +00:00
}
2024-10-08 21:57:25 +00:00
type PrototypeRequestBuilder interface {
RequestBuilder() (req RequestBuilder)
2024-10-07 21:39:42 +00:00
}
type Response interface {
Header() (header Header)
Bytes() (body []byte)
2024-10-07 21:39:42 +00:00
}
type PrototypeResponse interface {
Response() (res Response)
2024-10-07 21:39:42 +00:00
}
type ErrorResponse interface {
Ok() (ok bool)
HttpStatus() (code int)
Bytes() (body []byte)
String() (out string)
Error() (out string)
2024-10-07 21:39:42 +00:00
}
type PrototypeErrorResponse interface {
ErrorResponse() (errRes ErrorResponse)
2024-10-07 21:39:42 +00:00
}
type Prototype struct {
req PrototypeRequestBuilder
res PrototypeResponse
errRes PrototypeErrorResponse
2024-10-07 21:39:42 +00:00
}