Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var APIToken string
Functions ¶
func ListenAndServe ¶
ListenAndServe starts an http server at the given addr and requires a handler that will be called for each webhook request and passed a Results pointer. If an error is returned from the handler, a 500 response is sent and TypeForm will retry the request.
Note: the handler might be called multiple times for the same results set. You should store the Token for each call and verify you haven't already processed it.
Types ¶
type BooleanValue ¶
type BooleanValue bool
type ChoiceValue ¶
type ChoiceValue struct { Label string `json:"label" bson:"l,omitempty"` Other string `json:"other,omitempty" bson:"o,omitempty"` EmptyOther bool `json:"-" bson:"eo,omitempty"` }
ChoiceValue represents a number answer
func (*ChoiceValue) UnmarshalJSON ¶
func (v *ChoiceValue) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface
type ChoicesValue ¶
type ChoicesValue struct { Labels []string `json:"labels" bson:"l,omitempty"` Other string `json:"other,omitempty" bson:"o,omitempty"` EmptyOther bool `json:"-" bson:"eo,omitempty"` }
func (*ChoicesValue) UnmarshalJSON ¶
func (v *ChoicesValue) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface
type CreateResult ¶
type Error ¶
type NumberValue ¶
type NumberValue struct {
Amount int64 `json:"amount" bson:"a"`
}
NumberValue represents a number answer
type Results ¶
type Results struct { UID string `json:"uid" bson:"i"` Token string `json:"token" bson:"t"` Answers ResultsAnswerSlice `json:"answers" bson:"a"` }
Results represents a single set of answers received from typeform via the webhook in response to someone taking a form
type ResultsAnswer ¶
type ResultsAnswer struct { ResultsAnswerMetadata `bson:",inline"` Value interface{} `json:"value" bson:"v"` }
ResultsAnswer is a single answer in the Results The Value can be many different types. See http://docs.typeform.io/docs/results-introduction
func (*ResultsAnswer) SetBSON ¶
func (a *ResultsAnswer) SetBSON(raw bson.Raw) error
SetBSON implements the bson.Setter interface
func (*ResultsAnswer) String ¶
func (a *ResultsAnswer) String() string
String returns a string version of the answer
func (*ResultsAnswer) UnmarshalJSON ¶
func (a *ResultsAnswer) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface
type ResultsAnswerMetadata ¶
type ResultsAnswerMetadata struct { FieldID int64 `json:"field_id" bson:"i"` Type string `json:"type" bson:"t"` Tags []string `json:"tags,omitempty" bson:"g,omitempty"` }
ResultsAnswerMetadata is shared between the different forms of the answer
type ResultsAnswerSlice ¶
type ResultsAnswerSlice []ResultsAnswer
ResultsAnswerSlice implements the sort interface and sorts by FieldID ascending
func (ResultsAnswerSlice) Len ¶
func (s ResultsAnswerSlice) Len() int
Len implements the sort interface
func (ResultsAnswerSlice) Less ¶
func (s ResultsAnswerSlice) Less(i, j int) bool
Less implements the sort interface
func (ResultsAnswerSlice) Swap ¶
func (s ResultsAnswerSlice) Swap(i, j int)
Swap implements the sort interface