api

package
v0.0.0-...-c0d212d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldTypeDate           FieldType = "date"
	FieldTypeDropdown       FieldType = "dropdown"
	FieldTypeEmail          FieldType = "email"
	FieldTypeFileUpload     FieldType = "file_upload"
	FieldTypeGroup          FieldType = "group"
	FieldTypeLegal          FieldType = "legal"
	FieldTypeLongText       FieldType = "long_text"
	FieldTypeMultipleChoice FieldType = "multiple_choice"
	FieldTypeNumber         FieldType = "number"
	FieldTypeOpinionScale   FieldType = "opinion_scale"
	FieldTypePayment        FieldType = "payment"
	FieldTypePictureChoice  FieldType = "picture_choice"
	FieldTypeRating         FieldType = "rating"
	FieldTypeShortText      FieldType = "short_text"
	FieldTypeStatement      FieldType = "statement"
	FieldTypeWebsite        FieldType = "website"
	FieldTypeYesNo          FieldType = "yes_no"

	LogicTypeField  LogicType = "field"
	LogicTypeHidden LogicType = "hidden"

	ActionTypeJump     ActionType = "jump"
	ActionTypeAdd      ActionType = "add"
	ActionTypeSubtract ActionType = "subtract"
	ActionTypeMultiply ActionType = "multiply"
	ActionTypeDivide   ActionType = "divide"

	DetailToTypeField    DetailToType = "field"
	DetailToTypeHidden   DetailToType = "hidden"
	DetailToTypeThankyou DetailToType = "thankyou"

	DetailTargetTypeThankyou DetailTargetType = "variable"

	DetailTargetValueScore DetailTargetValue = "score"
	DetailTargetValuePrice DetailTargetValue = "price"

	ConditionOpBeginsWith       ConditionOp = "begins_with"
	ConditionOpEndsWith         ConditionOp = "ends_with"
	ConditionOpContains         ConditionOp = "contains"
	ConditionOpNotContains      ConditionOp = "not_contains"
	ConditionOpLowerThan        ConditionOp = "lower_than"
	ConditionOpLowerEqualThan   ConditionOp = "lower_equal_than"
	ConditionOpGreaterThan      ConditionOp = "greater_than"
	ConditionOpGreaterEqualThan ConditionOp = "greater_equal_than"
	ConditionOpIs               ConditionOp = "is"
	ConditionOpIsNot            ConditionOp = "is_not"
	ConditionOpEqual            ConditionOp = "equal"
	ConditionOpNotEqual         ConditionOp = "not_equal"
	ConditionOpAlways           ConditionOp = "always"
	ConditionOpOn               ConditionOp = "on"
	ConditionOpNotOn            ConditionOp = "not_on"
	ConditionOpEarlierThan      ConditionOp = "earlier_than"
	ConditionOpEarlierThanOrOn  ConditionOp = "earlier_than_or_on"
	ConditionOpLaterThan        ConditionOp = "later_than"
	ConditionOpLaterThanOrOn    ConditionOp = "later_than_or_on"

	ConditionVarTypeField    ConditionVarType = "field"
	ConditionVarTypeHidden   ConditionVarType = "hidden"
	ConditionVarTypeVariable ConditionVarType = "variable"
	ConditionVarTypeConstant ConditionVarType = "constant"
	ConditionVarTypeEnd      ConditionVarType = "end"
)
View Source
const (
	BaseUrl string = "https://api.typeform.com/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Action    ActionType `json:"action"`
	Details   Detail     `json:"details"`
	Condition Condition  `json:"condition"`
}

type ActionType

type ActionType string

type Attachment

type Attachment struct {
	Type string `json:"type"`
	Href string `json:"href"`
}

type Client

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

func DefaultClient

func DefaultClient(apiKey string) *Client

func (*Client) RestyClient

func (c *Client) RestyClient() *resty.Client

RestyClient provides access to the underlying Resty client

func (*Client) RetrieveForm

func (c *Client) RetrieveForm(formId string) (*Form, error)

Form resource as retrieved by a client editing the form.

type Condition

type Condition struct {
	Op   ConditionOp    `json:"op"`
	Vars []ConditionVar `json:"vars"`
}

type ConditionOp

type ConditionOp string

type ConditionVar

type ConditionVar struct {
	Type  ConditionVarType `json:"type"`
	Value interface{}      `json:"value"`
}

type ConditionVarType

type ConditionVarType string

type Detail

type Detail struct {
	To     DetailTo     `json:"to"`
	Target DetailTarget `json:"target,omitempty"`
	Value  DetailValue  `json:"value,omitempty"`
}

type DetailTarget

type DetailTarget struct {
	Type  DetailTargetType  `json:"type,omitempty"`
	Value DetailTargetValue `json:"value,omitempty"`
}

type DetailTargetType

type DetailTargetType string

type DetailTargetValue

type DetailTargetValue string

type DetailTo

type DetailTo struct {
	Type  DetailToType `json:"type,omitempty"`
	Value string       `json:"value,omitempty"`
}

type DetailToType

type DetailToType string

type DetailValue

type DetailValue struct {
	Type  string `json:"type,omitempty"`
	Value int    `json:"value,omitempty"`
}

type Field

type Field struct {
	ID          string           `json:"id"`
	Ref         string           `json:"ref"`
	Title       string           `json:"title"`
	Type        FieldType        `json:"type"`
	Properties  FieldProperties  `json:"properties,omitempty"`
	Validations FieldValidations `json:"validations"`
}

type FieldChoices

type FieldChoices struct {
	ID    string `json:"id"`
	Ref   string `json:"ref"`
	Label string `json:"label"`
}

type FieldProperties

type FieldProperties struct {
	Randomize              bool           `json:"randomize,omitempty"`                // TODO: Not omitempty?
	AllowMultipleSelection bool           `json:"allow_multiple_selection,omitempty"` // TODO: Not omitempty?
	AllowOtherChoice       bool           `json:"allow_other_choice,omitempty"`
	VerticalAlignment      bool           `json:"vertical_alignment,omitempty"`
	Choices                []FieldChoices `json:"choices,omitempty"`

	// TODO: These might only be for groups?
	Description string  `json:"description,omitempty"`
	ShowButton  bool    `json:"show_button,omitempty"`
	ButtonText  string  `json:"button_text,omitempty"`
	Fields      []Field `json:"fields,omitempty"`
}

type FieldType

type FieldType string

type FieldValidations

type FieldValidations struct {
	Required bool `json:"required"`
	MinValue int  `json:"min_value"` // TODO: Omitempty?
	MaxValue int  `json:"max_value"` // TODO: Omitempty?
}

type Form

type Form struct {
	ID              string           `json:"id"`
	Title           string           `json:"title"`
	Hidden          []string         `json:"hidden"`
	WelcomeScreens  []WelcomeScreen  `json:"welcome_screens"`
	ThankyouScreens []ThankyouScreen `json:"thankyou_screens"`
	Fields          []Field          `json:"fields"`
	Logic           []Logic          `json:"logic"`

	Theme     Href     `json:"theme"`
	Workspace Href     `json:"workspace"`
	Links     Links    `json:"_links"`
	Language  string   `json:"language,omitempty"` // TODO: Is this meant to be a field anymore? Seems to be in settings..
	Settings  Settings `json:"settings"`
}

type Href

type Href struct {
	Href string `json:"href"`
}
type Links struct {
	Display string `json:"display"`
}

type Logic

type Logic struct {
	Type    LogicType `json:"type"`
	Ref     string    `json:"ref"`
	Actions []Action  `json:"actions"`
}

type LogicType

type LogicType string

type NotificationRespondent

type NotificationRespondent struct {
	Recipient string `json:"recipient"`
	// contains filtered or unexported fields
}

type NotificationSelf

type NotificationSelf struct {
	Recipients []string `json:"recipients"`
	// contains filtered or unexported fields
}

type Notifications

type Notifications struct {
	Self       NotificationSelf       `json:"self"`
	Respondent NotificationRespondent `json:"respondent"`
}

type Settings

type Settings struct {
	IsPublic             bool   `json:"is_public"`
	IsTrial              bool   `json:"is_trial"`
	Language             string `json:"language"`
	ProgressBar          string `json:"progress_bar"`
	ShowProgressBar      bool   `json:"show_progress_bar"`
	ShowTypeformBranding bool   `json:"show_typeform_branding"`
	Meta                 struct {
		AllowIndexing bool `json:"allow_indexing"`
	} `json:"meta"`
	Notifications Notifications `json:"notifications"`
}

type ThankyouScreen

type ThankyouScreen struct {
	Ref        string                   `json:"ref"`
	Title      string                   `json:"title"`
	Properties ThankyouScreenProperties `json:"properties"`
	Attachment Attachment               `json:"attachment"`
}

type ThankyouScreenProperties

type ThankyouScreenProperties struct {
	ShowButton  bool   `json:"show_button"`
	ShareIcons  bool   `json:"share_icons"`
	ButtonMode  string `json:"button_mode"`
	ButtonText  string `json:"button_text"`
	RedirectUrl string `json:"redirect_url"`
}

type WelcomeScreen

type WelcomeScreen struct {
	Ref        string                  `json:"ref"`
	Title      string                  `json:"title"`
	Properties WelcomeScreenProperties `json:"properties"`
	Attachment Attachment              `json:"attachment"`
}

type WelcomeScreenProperties

type WelcomeScreenProperties struct {
	ShowButton  bool   `json:"show_button"`
	Description string `json:"description"`
	ButtonText  string `json:"button_text,omitempty"`
}

Jump to

Keyboard shortcuts

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