diff --git a/plugins/types.go b/plugins/types.go index fd949f7..20c36c8 100644 --- a/plugins/types.go +++ b/plugins/types.go @@ -77,12 +77,12 @@ type Middleware interface { // Validate request // If returns nil, it will pass the request onwards // If returns a pointer, request will get replied to with provided response - Request(resource string, headers map[string][]string) *middleware.RequestResponse + Request(resource string, headers map[string][]string, config interface{}) *middleware.RequestResponse // Validate and filter response // If returns nil, it will pass the request onwards with the returned data // If returns a pointer, request will get replied to with provided response without data - Response(resource string, headers map[string][]string, data []map[string]interface{}) ([]map[string]interface{}, *middleware.RequestResponse) + Response(resource string, headers map[string][]string, data []map[string]interface{}, config interface{}) ([]map[string]interface{}, *middleware.RequestResponse) } type Registry interface { diff --git a/schema/types.go b/schema/types.go index af01cff..cd2f905 100644 --- a/schema/types.go +++ b/schema/types.go @@ -19,7 +19,13 @@ type Schema struct { Meta ResourceMeta } +type MiddlewareMeta struct { + Type string `json:"type"` + Data interface{} `json:"data"` +} + type ResourceMeta struct { - Resource string `json:"resource"` - Store string `json:"store"` + Resource string `json:"resource"` + Store string `json:"store"` + Middlewares []MiddlewareMeta `json:"middlewares"` }