Beispiel #1
0
func (e Engine) Retrieve(params *tamber.EventParams) (*tamber.EventResult, error) {
	body := &url.Values{}
	params.AppendToBody(body)
	event := &tamber.EventResponse{}
	var err error

	err = e.S.Call("POST", "", e.Key, object, "retrieve", body, event)

	if !event.Succ {
		err = errors.New(event.Error)
	}
	return &event.Result, err
}
Beispiel #2
0
func (e Engine) Track(params *tamber.EventParams) (*tamber.EventResult, error) {
	body := &url.Values{}
	params.AppendToBody(body)
	event := &tamber.EventResponse{}
	var err error

	if len(params.User) > 0 && len(params.Item) > 0 && len(params.Behavior) > 0 {
		err = e.S.Call("POST", "", e.Key, object, "track", body, event)
	} else {
		err = errors.New("Invalid event params: user, item, and behavior need to be set")
	}

	if !event.Succ {
		err = errors.New(event.Error)
	}
	return &event.Result, err
}