Go library for Typeform APIs
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tfcom
tfio
README.md

README.md

typeform-go

Go library for Typeform APIs. No official. Lots of things not implemented. Currently unmaintained.

Implements:

Basic Examples

Creating a simple typeform

package main

import (
	"fmt"

	"github.com/xsb/typeform-go/tfio"
)

func main() {

	tfio.ApiToken = "<Your typeform.io API Token>"

	// Short Text field
	f1 := tfio.ShortText()
	f1.Question = "What's your name?"
	f1.Required = true

	// Multiple Choice field
	f2 := tfio.MultipleChoice()
	f2.Question = "Choose your favourite programming language"
	f2.Description = "It's Go, isn't it?"
	choices := []string{"Go", "Java", "Ruby", "JavaScript", "Python", "Perl"}
	for _, choice := range choices {
		f2.Choices = append(f2.Choices, tfio.Choice{choice})
	}

	// Create a typeform with the previous fields
	form := tfio.NewForm("My First Form")
	form.Fields = append(form.Fields, f1)
	form.Fields = append(form.Fields, f2)
	output, _ := form.CreateForm()
	fmt.Println(string(output))
}

Getting submissions from the Data API

package main

import (
	"fmt"

	"github.com/xsb/typeform-go/tfcom"
)

func main() {

	tfcom.ApiKey = "<Your typeform.com API Key>"
	formUid := "Form UID"

	b, err := tfcom.GetResponses(formUid)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}