router/prototype.go

39 lines
783 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-09 04:15:18 +00:00
Prototype() (req PrototypeRequestBuilder)
Allowed(method string) (errRes ErrorResponse)
Header(header Header) (errRes ErrorResponse)
2024-10-09 00:45:14 +00:00
ReadBody(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 {
2024-10-09 04:15:18 +00:00
Prototype() (req PrototypeResponse)
Header() (header Header)
2024-10-09 00:47:49 +00:00
BodyBytes() (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)
2024-10-09 00:47:49 +00:00
BodyBytes() (body []byte)
String() (out string)
Error() (out string)
2024-10-07 21:39:42 +00:00
}
type Prototype struct {
2024-10-08 23:15:07 +00:00
PrototypeRequestBuilder
PrototypeResponse
2024-10-07 21:39:42 +00:00
}