Documentation ¶
Index ¶
- Constants
- func NoBackoff(try int) time.Duration
- func TwoSecondsIncrementBackoff(try int) time.Duration
- type Attachment
- type Background
- type BackoffDuration
- type Client
- type Colors
- type Config
- type CreateImageParams
- type Error
- type Field
- type FieldChoice
- type FieldProperties
- type FieldValidations
- type FocalPoint
- type Form
- type FormLinks
- type FormList
- type FormListItem
- type FormListParams
- type FormService
- type Forms
- type Image
- type ImageList
- type ImageListItem
- type ImageService
- func (s ImageService) Create(p CreateImageParams) (Image, error)
- func (s ImageService) Delete(imageID string) error
- func (s ImageService) List() (ImageList, error)
- func (s ImageService) Retrieve(imageID string) (Image, error)
- func (s ImageService) RetrieveFormat(imageID, format, size string) (Image, error)
- type Layout
- type Link
- type Logic
- type LogicActionDetails
- type LogicActions
- type LogicCondition
- type LogicEvaluation
- type LogicJumpDestination
- type LogicVar
- type Notifications
- type Outcome
- type OutcomeChoice
- type Price
- type PropertyLabels
- type RespondentNotification
- type Response
- type ResponseList
- type ResponseListParams
- type ResponseService
- type Self
- type SelfNotification
- type Settings
- type SettingsMeta
- type TargetVariable
- type ThankYouScreen
- type ThankYouScreenProperties
- type Theme
- type ThemeList
- type ThemeListParams
- type ThemeService
- type VariableValue
- type WelcomeScreen
- type WelcomeScreenProperties
- type Workspace
- type WorkspaceList
- type WorkspaceMember
- type WorkspaceService
Constants ¶
View Source
const ( CodeAuthenticationFailed = "AUTHENTICATION_FAILED" CodeFormNotFound = "FORM_NOT_FOUND" CodeImageNotFound = "IMAGE_NOT_FOUND" CodeThemeNotFound = "THEME_NOT_FOUND" CodeWorkspaceNotFound = "WORKSPACE_NOT_FOUND" )
View Source
const ( FieldTypeYesNo = "yes_no" FieldTypeShortText = "short_text" FieldTypeMultipleChoice = "multiple_choice" FieldTypePictureChoice = "picture_choice" FieldTypeGroup = "group" FieldTypeEmail = "email" FieldTypeDropdown = "dropdown" FieldTypeLongText = "long_text" FieldTypeFileUpload = "file_upload" FieldTypeNumber = "number" FieldTypeWebsite = "website" FieldTypeLegal = "legal" FieldTypeDate = "date" FieldTypeRating = "rating" FieldTypeStatement = "statement" FieldTypePayment = "payment" FieldTypeOpinionScale = "opinion_scale" FieldTypePhoneNumber = "phone_number" )
View Source
const ( ImageFormatImage = "image" ImageFormatChoice = "choice" ImageFormatBackground = "background" ImageSizeDefault = "default" ImageSizeMobile = "mobile" ImageSizeSuperMobile = "supermobile" ImageSizeSuperMobileFit = "supermobilefit" ImageSizeSuperSize = "supersize" ImageSizeSuperSizeFit = "supersizefit" ImageSizeSuperTablet = "supertablet" ImageSizeTablet = "tablet" ImageSizeThumbnail = "thumbnail" )
Variables ¶
This section is empty.
Functions ¶
func NoBackoff ¶
NoBackoff is the no-op implementation of BackoffDuration. This means that there will be no pause between retries, which is not recommended for production usage.
func TwoSecondsIncrementBackoff ¶
TwoSecondsIncrementBackoff will retry after increases of 2 seconds between retries (2 seconds after first try, 4 seconds after the second, and so forth)
Types ¶
type Attachment ¶
type Background ¶
type BackoffDuration ¶
BackoffDuration will determine for how long the client should wait before retrying a request after a given `try`.
type Client ¶
type Client struct { // AccessToken to access the typeform API. AccessToken string // HttpClient that will be used to do http calls to the API. HttpClient http.Client // BaseURL is the base URL to be used in all requests to the API. BaseURL url.URL // MaxRetries is the maximum number of retries that will be done to the API on transient errors. MaxRetries int // BackoffDuration is the duration off the backoff period between retries. BackoffDuration BackoffDuration }
client will be used to interact with the typeform API.
func NewClient ¶
NewClient will return a default client with values overridden by the provided config.
func NewDefaultClient ¶
NewDefaultClient will return a production client will all its config values set to defaults.
type Config ¶
type Config struct { // BaseAddress is the base address of the API, which can be configured to point to fake implementations of the // API for testing purposes. Defaults to https://api.typeform.com BaseAddress string // HttpTimeoutSeconds is the timeout to be used in http calls to the API, 30 seconds by default. HttpTimeoutSeconds int // MaxRetries is the maximum number of retries that will be done to the API on transient errors, 5 by default. MaxRetries int // BackoffDuration is the duration off the backoff period between retries, defaults to TwoSecondsIncrementBackoff. BackoffDuration BackoffDuration // HttpClient can be used to override the HTTP client that will calls to the typeform API, defaults // to http.DefaultClient with a Timeout of 30seconds. Setting it will override HttpTimeoutSeconds. HttpClient *http.Client }
type CreateImageParams ¶
type Error ¶
type Field ¶
type Field struct { ID string `json:"id,omitempty"` Ref string `json:"ref,omitempty"` Title string `json:"title"` Properties *FieldProperties `json:"properties,omitempty"` Validations *FieldValidations `json:"validations,omitempty"` Type string `json:"type"` Attachment *Attachment `json:"attachment,omitempty"` Layout *Layout `json:"Layout,omitempty"` }
type FieldChoice ¶
type FieldChoice struct { ID string `json:"id,omitempty"` Ref string `json:"ref,omitempty"` Label string `json:"label"` Attachment *Attachment `json:"attachment,omitempty"` }
type FieldProperties ¶
type FieldProperties struct { Description string `json:"description,omitempty"` ButtonText string `json:"button_text,omitempty"` Randomize *bool `json:"randomize,omitempty"` AllowMultipleSelection *bool `json:"allow_multiple_selection,omitempty"` AllowOtherChoice *bool `json:"allow_other_choice,omitempty"` VerticalAlignment *bool `json:"vertical_alignment,omitempty"` Supersized *bool `json:"supersized,omitempty"` ShowLabels *bool `json:"show_labels,omitempty"` ShowButton *bool `json:"show_button,omitempty"` AlphabeticalOrder *bool `json:"alphabetical_order,omitempty"` HideMarks *bool `json:"hide_marks,omitempty"` StartAtOne *bool `json:"start_at_one,omitempty"` Choices *[]*FieldChoice `json:"choices,omitempty"` Fields []*Field `json:"fields,omitempty"` Separator string `json:"separator,omitempty"` Structure string `json:"structure,omitempty"` Shape string `json:"shape,omitempty"` DefaultCountryCode string `json:"default_country_code,omitempty"` Currency string `json:"currency,omitempty"` Steps int `json:"steps,omitempty"` Price *Price `json:"price,omitempty"` Labels *PropertyLabels `json:"labels,omitempty"` }
type FieldValidations ¶
type FocalPoint ¶
type Form ¶
type Form struct { ID string `json:"id,omitempty"` Title string `json:"title"` Workspace *Link `json:"workspace,omitempty"` Theme *Link `json:"theme,omitempty"` Settings *Settings `json:"settings,omitempty"` ThankyouScreens []*ThankYouScreen `json:"thankyou_screens,omitempty"` WelcomeScreens []*WelcomeScreen `json:"welcome_screens,omitempty"` Fields []*Field `json:"fields,omitempty"` Hidden []string `json:"hidden,omitempty"` Variables map[string]interface{} `json:"variables,omitempty"` Logic []*Logic `json:"logic,omitempty"` Outcome *Outcome `json:"outcome,omitempty"` Links *FormLinks `json:"_links,omitempty"` }
type FormList ¶
type FormList struct { TotalItems int `json:"total_items"` PageCount int `json:"page_count"` Items []FormListItem `json:"items"` }
type FormListItem ¶
type FormListItem struct { ID string `json:"id"` Title string `json:"title"` LastUpdatedAt time.Time `json:"last_updated_at"` Self struct { Href string `json:"href"` } `json:"self"` Theme struct { Href string `json:"href"` } `json:"theme"` Links struct { Display string `json:"display"` } `json:"_links"` }
type FormListParams ¶
type FormService ¶
type FormService struct {
// contains filtered or unexported fields
}
func NewFormService ¶
func NewFormService(client Client) *FormService
func (FormService) Delete ¶
func (s FormService) Delete(formID string) error
func (FormService) List ¶
func (s FormService) List(p FormListParams) (FormList, error)
type Image ¶
type Image struct { ID string `json:"id,omitempty"` Src string `json:"src,omitempty"` FileName string `json:"file_name,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` MediaType string `json:"media_type,omitempty"` HasAlpha bool `json:"has_alpha,omitempty"` AvgColor string `json:"avg_color,omitempty"` }
type ImageList ¶
type ImageList []ImageListItem
type ImageListItem ¶
type ImageService ¶
type ImageService struct {
// contains filtered or unexported fields
}
func NewImageService ¶
func NewImageService(client Client) *ImageService
func (ImageService) Create ¶
func (s ImageService) Create(p CreateImageParams) (Image, error)
func (ImageService) Delete ¶
func (s ImageService) Delete(imageID string) error
func (ImageService) List ¶
func (s ImageService) List() (ImageList, error)
func (ImageService) RetrieveFormat ¶
func (s ImageService) RetrieveFormat(imageID, format, size string) (Image, error)
type Layout ¶
type Layout struct { Type string `json:"type"` Attachment Attachment `json:"Attachment"` }
type Logic ¶
type Logic struct { Type string `json:"type"` Ref string `json:"ref,omitempty"` Actions []*LogicActions `json:"actions"` }
type LogicActionDetails ¶
type LogicActionDetails struct { To *LogicJumpDestination `json:"to,omitempty"` Target *TargetVariable `json:"target,omitempty"` Value *VariableValue `json:"value,omitempty"` }
type LogicActions ¶
type LogicActions struct { Action string `json:"action"` Details LogicActionDetails `json:"details"` Condition LogicCondition `json:"condition"` }
type LogicCondition ¶
type LogicEvaluation ¶
type LogicEvaluation struct { Op string `json:"op"` Vars []*TargetVariable `json:"vars"` }
type LogicJumpDestination ¶
type LogicVar ¶
type LogicVar struct { *LogicCondition Type string `json:"type,omitempty"` Value interface{} `json:"value,omitempty"` }
type Notifications ¶
type Notifications struct { Self *SelfNotification `json:"self,omitempty"` Respondent *RespondentNotification `json:"respondent,omitempty"` }
type Outcome ¶
type Outcome struct { Variable string `json:"variable"` Choices []*OutcomeChoice `json:"choices"` }
type OutcomeChoice ¶
type PropertyLabels ¶
type RespondentNotification ¶
type Response ¶
type Response struct { LandingID string `json:"landing_id"` Token string `json:"token"` ResponseID string `json:"response_id,omitempty"` LandedAt time.Time `json:"landed_at"` SubmittedAt time.Time `json:"submitted_at"` Metadata struct { UserAgent string `json:"user_agent"` Platform string `json:"platform"` Referer string `json:"referer"` NetworkID string `json:"network_id"` Browser string `json:"browser"` } `json:"metadata"` Answers []struct { Field struct { ID string `json:"id"` Type string `json:"type"` Ref string `json:"ref"` } `json:"field"` Type string `json:"type"` Text string `json:"text,omitempty"` Boolean bool `json:"boolean,omitempty"` Email string `json:"email,omitempty"` Number int `json:"number,omitempty"` Choices struct { Labels []string `json:"labels"` } `json:"choices,omitempty"` Date time.Time `json:"date,omitempty"` Choice struct { Label string `json:"label"` } `json:"choice,omitempty"` } `json:"answers"` Hidden map[string]string `json:"hidden,omitempty"` Calculated map[string]interface{} `json:"calculated"` }
type ResponseList ¶
type ResponseListParams ¶
type ResponseListParams struct { PageSize int `url:"page_size,omitempty"` Since *time.Time `url:"since,omitempty"` Until *time.Time `url:"until,omitempty"` After *time.Time `url:"after,omitempty"` Before *time.Time `url:"before,omitempty"` IncludedResponseIDs string `url:"included_response_ids,omitempty"` Completed *bool `url:"completed,omitempty"` Sort string `url:"sort,omitempty"` Query string `url:"query,omitempty"` Fields string `url:"fields,omitempty"` }
type ResponseService ¶
type ResponseService struct {
// contains filtered or unexported fields
}
func NewResponseService ¶
func NewResponseService(client Client) *ResponseService
func (ResponseService) Delete ¶
func (s ResponseService) Delete(formID string, includedTokens []string) error
func (ResponseService) List ¶
func (s ResponseService) List(formID string, p ResponseListParams) (ResponseList, error)
type SelfNotification ¶
type Settings ¶
type Settings struct { Language string `json:"language"` ProgressBar string `json:"progress_bar"` Meta SettingsMeta `json:"meta"` IsPublic bool `json:"is_public"` IsTrial bool `json:"is_trial"` ShowProgressBar bool `json:"show_progress_bar"` ShowTypeformBranding bool `json:"show_typeform_branding"` RedirectAfterSubmitURL string `json:"redirect_after_submit_url,omitempty"` FacebookPixel string `json:"facebook_pixel,omitempty"` GoogleAnalytics string `json:"google_analytics,omitempty"` GoogleTagManager string `json:"google_tag_manager,omitempty"` Notifications *Notifications `json:"Notifications,omitempty"` }
type SettingsMeta ¶
type TargetVariable ¶
type ThankYouScreen ¶
type ThankYouScreen struct { ID string `json:"id,omitempty"` Ref string `json:"ref,omitempty"` Title string `json:"title"` Properties ThankYouScreenProperties `json:"properties"` Attachment *Attachment `json:"attachment,omitempty"` }
type Theme ¶
type Theme struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Visibility string `json:"visibility,omitempty"` Background *Background `json:"background,omitempty"` Colors *Colors `json:"colors,omitempty"` Font string `json:"font,omitempty"` HasTransparentButton bool `json:"has_transparent_button,omitempty"` }
type ThemeListParams ¶
type ThemeService ¶
type ThemeService struct {
// contains filtered or unexported fields
}
func NewThemeService ¶
func NewThemeService(client Client) *ThemeService
func (ThemeService) Delete ¶
func (s ThemeService) Delete(themeID string) error
func (ThemeService) List ¶
func (s ThemeService) List(p ThemeListParams) (ThemeList, error)
type VariableValue ¶
type VariableValue struct { Type string `json:"type"` Value interface{} `json:"value,omitempty"` Evaluation *LogicEvaluation `json:"evaluation,omitempty"` }
type WelcomeScreen ¶
type WelcomeScreen struct { ID string `json:"id,omitempty"` Ref string `json:"ref,omitempty"` Title string `json:"title"` Properties WelcomeScreenProperties `json:"properties"` Attachment *Attachment `json:"attachment,omitempty"` }
type WelcomeScreenProperties ¶
type WorkspaceList ¶
type WorkspaceMember ¶
type WorkspaceService ¶
type WorkspaceService struct {
// contains filtered or unexported fields
}
func NewWorkspaceService ¶
func NewWorkspaceService(client Client) *WorkspaceService
func (WorkspaceService) Delete ¶
func (s WorkspaceService) Delete(workspaceID string) error
func (WorkspaceService) List ¶
func (s WorkspaceService) List() (WorkspaceList, error)
Click to show internal directories.
Click to hide internal directories.