Documentation ¶
Index ¶
- Constants
- func ApiHandler(schemas *client.Schemas, f http.Handler) http.Handler
- func CollectionToMap(obj interface{}, schemas *client.Schemas) (map[string]interface{}, []map[string]interface{}, error)
- func CreateApiContext(rw http.ResponseWriter, r *http.Request, schemas *client.Schemas) error
- func IsBrowser(r *http.Request, checkAccepts bool) bool
- func ResourceToMap(obj interface{}, schemas *client.Schemas) (map[string]interface{}, error)
- func SchemaHandler(schemas *client.Schemas) http.Handler
- func SchemasHandler(schemas *client.Schemas) http.Handler
- func VersionHandler(schemas *client.Schemas, version string) http.Handler
- func VersionsHandler(schemas *client.Schemas, versions ...string) http.Handler
- type ApiContext
- type ApiResponseWriter
- type HtmlWriter
- type JsonWriter
- type UrlBuilder
Constants ¶
View Source
const ( DEFAULT_OVERRIDE_URL_HEADER = "X-API-request-url" DEFAULT_OVERRIDE_CLIENT_IP_HEADER = "X-API-client-ip" FORWARDED_FOR_HEADER = "X-Forwarded-For" FORWARDED_HOST_HEADER = "X-Forwarded-Host" FORWARDED_PROTO_HEADER = "X-Forwarded-Proto" FORWARDED_PORT_HEADER = "X-Forwarded-Port" SELF = "self" COLLECTION = "collection" LATEST = "latest" HTML = "html" JSON = "json" )
Variables ¶
This section is empty.
Functions ¶
func CollectionToMap ¶
func CreateApiContext ¶
func ResourceToMap ¶
Types ¶
type ApiContext ¶
type ApiContext struct { UrlBuilder UrlBuilder // contains filtered or unexported fields }
func GetApiContext ¶
func GetApiContext(r *http.Request) *ApiContext
func (*ApiContext) Write ¶
func (a *ApiContext) Write(obj interface{})
func (*ApiContext) WriteCollection ¶
func (a *ApiContext) WriteCollection(obj interface{}) error
func (*ApiContext) WriteResource ¶
func (a *ApiContext) WriteResource(obj interface{}) error
type ApiResponseWriter ¶
type ApiResponseWriter interface {
Write(obj interface{}, rw http.ResponseWriter) error
}
type HtmlWriter ¶
type HtmlWriter struct {
CssUrl, JsUrl string
// contains filtered or unexported fields
}
func (*HtmlWriter) Write ¶
func (j *HtmlWriter) Write(obj interface{}, rw http.ResponseWriter) error
type JsonWriter ¶
type JsonWriter struct {
// contains filtered or unexported fields
}
func (*JsonWriter) Write ¶
func (j *JsonWriter) Write(obj interface{}, rw http.ResponseWriter) error
type UrlBuilder ¶
type UrlBuilder interface { //ActionLink(resource client.Resource, name string) string Current() string Collection(resourceType string) string Link(resource client.Resource, name string) string ReferenceLink(resource client.Resource) string ReferenceByIdLink(resourceType string, id string) string Version(version string) string }
func NewUrlBuilder ¶
Click to show internal directories.
Click to hide internal directories.