Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrVersionNotFound = errors.New("Version not found") ErrVersionDuplicate = errors.New("Version with same identifer already present") )
Common errors
Functions ¶
This section is empty.
Types ¶
type VendorMiddleware ¶
type VendorMiddleware struct {
// contains filtered or unexported fields
}
VendorMiddleware dispatches the request regarding the wanted version.
func NewVendorMiddleware ¶
func NewVendorMiddleware(name string, versions ...*Version) (*VendorMiddleware, error)
NewVendorMiddleware returns a new middleware.
func (*VendorMiddleware) CheckVendorHandler ¶
func (v *VendorMiddleware) CheckVendorHandler(h http.Handler) http.Handler
CheckVendorHandler wraps an handler and call it only if the vendor corresponds to the appropriate vendor.
func (*VendorMiddleware) DispatchVersion ¶
func (v *VendorMiddleware) DispatchVersion() http.Handler
DispatchVersion returns the handler that corresponds to the appropriate version.
func (*VendorMiddleware) ServeHTTP ¶
func (v *VendorMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
Default implementation in case of non using a middleware
func (*VendorMiddleware) VendorName ¶
func (v *VendorMiddleware) VendorName() string
VendorName returns the vendorName used to determine the vendor used in the "Accept" header.
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version represents an API version.
func NewVersion ¶
NewVersion creates a new API with a specified name.
Click to show internal directories.
Click to hide internal directories.