Documentation
¶
Overview ¶
Defines handlers, kind of like base classes for endpoints
Example (MakePath) ¶
fmt.Println(MakeEndpointPath("roi", "sol", "experiment", "name"))
fmt.Println(MakeEndpointPath("/roi", "did", "name"))
fmt.Println(MakeEndpointPath("roi", "sol/", "/experiment", "/name"))
fmt.Println(MakeEndpointPath("/roi", "name"))
Output: /roi/{sol}/{experiment}/{name} /roi/{did}/{name} /roi/{sol}/{experiment}/{name} /roi/{name}
Index ¶
- Constants
- func MakeEndpointPath(pathPrefix string, pathParamNames ...string) string
- type ApiCacheControlledStreamFromS3Handler
- type ApiCacheControlledStreamHandlerFunc
- type ApiHandlerFunc
- type ApiHandlerGeneric
- type ApiHandlerGenericFunc
- type ApiHandlerGenericParams
- type ApiHandlerGenericPublic
- type ApiHandlerGenericPublicFunc
- type ApiHandlerGenericPublicParams
- type ApiHandlerJSON
- type ApiHandlerParams
- type ApiHandlerStreamParams
- type ApiSharingHandler
- type ApiStreamFromS3Handler
- type ApiStreamHandlerFunc
Examples ¶
Constants ¶
View Source
const HostParamName = "hostname"
View Source
const UrlStreamDownloadIndicator = "download"
Variables ¶
This section is empty.
Functions ¶
func MakeEndpointPath ¶
Public general-purpose functions
Types ¶
type ApiCacheControlledStreamFromS3Handler ¶
type ApiCacheControlledStreamFromS3Handler struct {
*services.APIServices
Stream ApiCacheControlledStreamHandlerFunc
}
func (ApiCacheControlledStreamFromS3Handler) ServeHTTP ¶
func (h ApiCacheControlledStreamFromS3Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ApiCacheControlledStreamHandlerFunc ¶
type ApiCacheControlledStreamHandlerFunc func(ApiHandlerStreamParams) (*s3.GetObjectOutput, string, string, string, int, error)
type ApiHandlerFunc ¶
type ApiHandlerFunc func(ApiHandlerParams) (interface{}, error)
type ApiHandlerGeneric ¶
type ApiHandlerGeneric struct {
*services.APIServices
Handler ApiHandlerGenericFunc
}
func (ApiHandlerGeneric) ServeHTTP ¶
func (h ApiHandlerGeneric) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ApiHandlerGenericFunc ¶
type ApiHandlerGenericFunc func(ApiHandlerGenericParams) error
type ApiHandlerGenericParams ¶
type ApiHandlerGenericParams struct {
Svcs *services.APIServices
UserInfo pixlUser.UserInfo
PathParams map[string]string
Writer http.ResponseWriter
Request *http.Request
}
If all else fails, use this. Is the most generic handler, passes in request & response writer like raw ServeHTTP but also passed the parsed user info & path params
type ApiHandlerGenericPublic ¶
type ApiHandlerGenericPublic struct {
*services.APIServices
Handler ApiHandlerGenericPublicFunc
}
func (ApiHandlerGenericPublic) ServeHTTP ¶
func (h ApiHandlerGenericPublic) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ApiHandlerGenericPublicFunc ¶
type ApiHandlerGenericPublicFunc func(ApiHandlerGenericPublicParams) error
type ApiHandlerGenericPublicParams ¶
type ApiHandlerGenericPublicParams struct {
Svcs *services.APIServices
PathParams map[string]string
Writer http.ResponseWriter
Request *http.Request
}
As with generic handler, but for public API endpoints ONLY
type ApiHandlerJSON ¶
type ApiHandlerJSON struct {
*services.APIServices
Handler ApiHandlerFunc
}
func (ApiHandlerJSON) ServeHTTP ¶
func (h ApiHandlerJSON) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ApiHandlerParams ¶
type ApiHandlerParams struct {
Svcs *services.APIServices
UserInfo pixlUser.UserInfo
PathParams map[string]string
Request *http.Request
}
If returning JSON, use this
type ApiHandlerStreamParams ¶
type ApiHandlerStreamParams struct {
Svcs *services.APIServices
UserInfo pixlUser.UserInfo
PathParams map[string]string
Headers http.Header
}
If it's a handler that streams a file from S3 to the client, use this
type ApiSharingHandler ¶
type ApiSharingHandler struct {
*services.APIServices
}
If it's a share function, use this. Enforces that method is only POST
func (ApiSharingHandler) ServeHTTP ¶
func (h ApiSharingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ApiStreamFromS3Handler ¶
type ApiStreamFromS3Handler struct {
*services.APIServices
Stream ApiStreamHandlerFunc
}
func (ApiStreamFromS3Handler) ServeHTTP ¶
func (h ApiStreamFromS3Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ApiStreamHandlerFunc ¶
type ApiStreamHandlerFunc func(ApiHandlerStreamParams) (*s3.GetObjectOutput, string, error)
Click to show internal directories.
Click to hide internal directories.