package api

import (
	"net/http"
)

type AuthScope int
type AuthScopes map[AuthScope]string

type ServiceMethod int
type EventKey string

type ObjectFactory func(*http.Request) interface{}

type HttpMethod string
type QueryDefault interface{}
type UrlQueries map[string]QueryDefault
type HttpHeaders map[string]string

var (
	GET       HttpMethod = HttpMethod("GET")
	POST      HttpMethod = HttpMethod("POST")
	PUT       HttpMethod = HttpMethod("PUT")
	DELETE    HttpMethod = HttpMethod("DELETE")
	MULTIPART HttpMethod = HttpMethod("POST")
)

type MethodSpec struct {
	Doc                  string
	UrlRoute             string
	HttpHeaders          HttpHeaders
	HttpMethod           HttpMethod
	UrlQueries           UrlQueries
	ContentTypes         []string
	RequestBody          ObjectFactory
	ResponseBody         ObjectFactory
	CallbackEvent        EventKey
	CallbackBodyTemplate string
	AuthScope            string
}

type ServiceMethods map[ServiceMethod]MethodSpec

package api

type AuthScope int
type AuthScopes map[AuthScope]string

type ServiceMethod int
type EventKey string

type ObjectFactory func() interface{}

type HttpMethod string
type QueryDefault interface{}
type UrlQueries map[string]QueryDefault
type HttpHeaders map[string]string

var (
	GET       HttpMethod = HttpMethod("GET")
	POST      HttpMethod = HttpMethod("POST")
	PUT       HttpMethod = HttpMethod("PUT")
	DELETE    HttpMethod = HttpMethod("DELETE")
	MULTIPART HttpMethod = HttpMethod("POST")
)

type MethodSpec struct {
	Doc                  string
	UrlRoute             string
	HttpHeaders          HttpHeaders
	HttpMethod           HttpMethod
	UrlQueries           UrlQueries
	ContentTypes         []string
	RequestBody          ObjectFactory
	ResponseBody         ObjectFactory
	CallbackEvent        EventKey
	CallbackBodyTemplate string
	AuthScope            string
}

type ServiceMethods map[ServiceMethod]MethodSpec

--- 
+++ 
@@ -1,4 +1,8 @@
 package api
+
+import (
+	"net/http"
+)
 
 type AuthScope int
 type AuthScopes map[AuthScope]string
@@ -6,7 +10,7 @@
 type ServiceMethod int
 type EventKey string
 
-type ObjectFactory func() interface{}
+type ObjectFactory func(*http.Request) interface{}
 
 type HttpMethod string
 type QueryDefault interface{}
Change in API RequestBody/ ObjectFactory signature to allow different prototype objects based on http request (content-type)
