Documentation
¶
Index ¶
Constants ¶
Variables ¶
var ( ErrReqNotSet = errors.New("req is not set") ErrInvalidFieldType = errors.New("invalid field type") ErrInvalidKey = errors.New("invalid key") )
var ErrCacheKeyNotFound = errors.New("key not found")
ErrCacheKeyNotFound is returned when a non-existent cache key is requested
var (
ErrFileFuncNotSet = errors.New("file func not set")
)
Functions ¶
This section is empty.
Types ¶
type AuthHeader ¶
AuthHeader is an HTTP header designed to authenticate requests
type AuthProvider ¶
type AuthProvider interface {
HeaderForDomain(string) *AuthHeader
}
AuthProvider is a provider for various kinds of auth
func DefaultAuthProvider ¶
func DefaultAuthProvider(config *AuthProviderConfig) AuthProvider
DefaultAuthProvider creates the default static auth provider
type AuthProviderConfig ¶
type AuthProviderConfig struct {
// Headers is a map between domains and auth header that should be added to requests to those domains
Headers map[string]AuthHeader `json:"headers"`
}
AuthProviderConfig is a config for the default auth provider
type Cache ¶
type Cache interface {
Set(key string, val []byte, ttl int) error
Get(key string) ([]byte, error)
Delete(key string) error
}
Cache gives Runnables access to a key/value cache
func DefaultCache ¶
func DefaultCache() Cache
type FileSource ¶
FileSource gives runnables access to various kinds of files
func DefaultFileSource ¶
func DefaultFileSource(staticFileFunc StaticFileFunc) FileSource
type GraphQLClient ¶
type GraphQLClient interface {
Do(auth AuthProvider, endpoint, query string) (*GraphQLResponse, error)
}
GraphQLClient is a GraphQL capability for Reactr Modules
func DefaultGraphQLClient ¶
func DefaultGraphQLClient() GraphQLClient
DefaultGraphQLClient creates a GraphQLClient object
type GraphQLError ¶
GraphQLError is a GraphQL error
type GraphQLRequest ¶
type GraphQLRequest struct {
Query string `json:"query"`
Variables map[string]string `json:"variables,omitempty"`
OperationName string `json:"operationName,omitempty"`
}
GraphQLRequest is a request to a GraphQL endpoint
type GraphQLResponse ¶
type GraphQLResponse struct {
Data map[string]interface{} `json:"data"`
Errors []GraphQLError `json:"errors,omitempty"`
}
GraphQLResponse is a GraphQL response
type HTTPClient ¶
type HTTPClient interface {
Do(auth AuthProvider, method, urlString string, body []byte, headers http.Header) (*http.Response, error)
}
HTTPClient gives Runnables the ability to make HTTP requests
func DefaultHTTPClient ¶
func DefaultHTTPClient() HTTPClient
DefaultHTTPClient creates an HTTP client with no restrictions
type LoggerSource ¶
LoggerSource provides a logger to Runnables
func DefaultLoggerSource ¶
func DefaultLoggerSource(logger *vlog.Logger) LoggerSource
DefaultLoggerSource returns a LoggerSource that provides vlog.Default
type RequestHandler ¶
type RequestHandler struct {
// contains filtered or unexported fields
}
RequestHandler allows runnables to handle HTTP requests
func NewRequestHandler ¶
func NewRequestHandler(req *request.CoordinatedRequest) *RequestHandler
NewRequestHandler provides a handler for the given request
func (RequestHandler) GetField ¶
func (r RequestHandler) GetField(fieldType int32, key string) ([]byte, error)
func (RequestHandler) SetResponseHeader ¶
func (r RequestHandler) SetResponseHeader(key, val string) error
SetResponseHeader sets a header on the response
type StaticFileFunc ¶
StaticFileFunc is a function that returns the contents of a requested file