api

package
v0.0.0-...-449281a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2015 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFoundError      = StatusError{Message: "Resource not found", Code: http.StatusNotFound}
	AuthKeyError       = StatusError{Message: "Auth Key is missing", Code: http.StatusBadRequest}
	InvalidApiKeyError = StatusError{Message: "Requires a valid api key", Code: http.StatusBadRequest}
	ParamsMissingError = StatusError{Message: "Required parameters are missing", Code: http.StatusBadRequest}
	KeenAddonError     = StatusError{Message: "Keen Addon Invocation failed", Code: http.StatusBadRequest}
)
View Source
var (
	InvalidTimeFrameError = errors.New("Invalid timeframe")
	InvalidGroupByError   = errors.New("Invalid group_by")
	InvalidFilterError    = errors.New("Invalid filter")
	InvalidIntervalError  = errors.New("Invalid timeframe")
)

Functions

func HandleCreateEvent

func HandleCreateEvent(w rest.ResponseWriter, req *rest.Request)

Require a write key. Create a event.

func HandleCreateMultiEvents

func HandleCreateMultiEvents(w rest.ResponseWriter, req *rest.Request)

Require a write key. Create multiple events with a single request.

func HandleInspectAllCollections

func HandleInspectAllCollections(w rest.ResponseWriter, req *rest.Request)

func HandleInspectAndCreateEvent

func HandleInspectAndCreateEvent(w rest.ResponseWriter, req *rest.Request)

func HandleQueryAverage

func HandleQueryAverage(w rest.ResponseWriter, req *rest.Request)

func HandleQueryCount

func HandleQueryCount(w rest.ResponseWriter, req *rest.Request)

func HandleQueryExtraction

func HandleQueryExtraction(w rest.ResponseWriter, req *rest.Request)

func HandleQueryMax

func HandleQueryMax(w rest.ResponseWriter, req *rest.Request)

func HandleQueryMedian

func HandleQueryMedian(w rest.ResponseWriter, req *rest.Request)

func HandleQueryMin

func HandleQueryMin(w rest.ResponseWriter, req *rest.Request)

func HandleQueryPercentile

func HandleQueryPercentile(w rest.ResponseWriter, req *rest.Request)

func HandleQuerySelectUnique

func HandleQuerySelectUnique(w rest.ResponseWriter, req *rest.Request)

func HandleQuerySum

func HandleQuerySum(w rest.ResponseWriter, req *rest.Request)

func HandleQueryUniqueCount

func HandleQueryUniqueCount(w rest.ResponseWriter, req *rest.Request)

func RequireMasterKey

func RequireMasterKey(w rest.ResponseWriter, req *rest.Request) error

func RequireReadKey

func RequireReadKey(w rest.ResponseWriter, req *rest.Request) error

func RequireWriteKey

func RequireWriteKey(w rest.ResponseWriter, req *rest.Request) error

func Routes

func Routes(routes ...*rest.Route) []*rest.Route

Types

type Aggregator

type Aggregator func(*QueryParams, interface{}) error

type CreateMultipleEventParams

type CreateMultipleEventParams map[string][]CreateSingleEventParams

type CreateSingleEventParams

type CreateSingleEventParams RawResult

type Filter

type Filter struct {
	PropertyName  string      `json:"property_name"`
	Operator      string      `json:"operator"`
	PropertyValue interface{} `json:"property_value"`
}

type Filters

type Filters []Filter

type GroupBy

type GroupBy []string

func (*GroupBy) UnmarshalJSON

func (g *GroupBy) UnmarshalJSON(data []byte) error

type Interval

type Interval string

func (Interval) IsGiven

func (i Interval) IsGiven() bool

func (Interval) NextTime

func (i Interval) NextTime(t time.Time) (time.Time, error)

type Keen

type Keen struct {
	Addons []KeenAddon
}

type KeenAddon

type KeenAddon struct {
	Name   string
	Input  map[string]interface{}
	Output string
}

func (*KeenAddon) ResolveInput

func (this *KeenAddon) ResolveInput(doc map[string]interface{}) error

type KeenAddonApplier

type KeenAddonApplier interface {
	Apply(doc map[string]interface{}) error
}

type KeenUrlParser

type KeenUrlParser KeenAddon

func (*KeenUrlParser) Apply

func (this *KeenUrlParser) Apply(doc map[string]interface{}) error

type Params

type Params struct {
	// contains filtered or unexported fields
}

func NewParams

func NewParams(req *rest.Request) *Params

func (*Params) Parse

func (this *Params) Parse(out interface{}) error

func (*Params) Require

func (this *Params) Require(keys ...string) *Params

type Presenter

type Presenter struct {
	// contains filtered or unexported fields
}

func NewPresenter

func NewPresenter(a Aggregator, p *QueryParams) *Presenter

func (*Presenter) Present

func (this *Presenter) Present() (interface{}, error)

type QueryParams

type QueryParams struct {
	CollectionName string    `json:"event_collection"`
	TimeFrame      TimeFrame `json:"timeframe"`
	GroupBy        GroupBy   `json:"group_by"`
	Filters        Filters   `json:"filters"`
	Interval       Interval  `json:"interval"`
}

func (*QueryParams) ToQuery

func (this *QueryParams) ToQuery() *query.Arel

type RawResult

type RawResult map[string]interface{}

type StatusError

type StatusError struct {
	Code    int
	Message string
}

func (StatusError) Error

func (e StatusError) Error() string

type StringInt

type StringInt int

func (*StringInt) UnmarshalJSON

func (this *StringInt) UnmarshalJSON(data []byte) error

type TimeFrame

type TimeFrame struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
	// contains filtered or unexported fields
}

func (*TimeFrame) IsGiven

func (this *TimeFrame) IsGiven() bool

func (*TimeFrame) UnmarshalJSON

func (t *TimeFrame) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL