Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jozsefsallai/go-strawpoll

strawpoll API wrapper for go
https://github.com/jozsefsallai/go-strawpoll

golang strawpoll

Last synced: about 2 months ago
JSON representation

strawpoll API wrapper for go

Awesome Lists containing this project

README

        

# go-strawpoll

go-strawpoll provides an easy way to fetch and create polls from/to strawpoll.me.

## Getting Started

**Add go-strawpoll to your dependencies:**
```
go get -u github.com/jozsefsallai/go-strawpoll
```

**To fetch a poll:**

```go
func main() {
poll, err := strawpoll.Get(1)
if err != nil {
panic(err)
}
fmt.Println(poll.Title)
}
```

(where `1` is the ID of the poll on strawpoll.me)

**To create a poll:**

```go
func main() {
poll, err := strawpoll.Create(
"title of the poll",
[]string{"option 1", "option 2", "option 3"}, // at least 2
false, // multi-choice
strawpoll.DupcheckNormal, // duplication checking level
false, // require CAPTCHA
)

if err != nil {
panic(err)
}

fmt.Println(poll.ID)
}
```

## Documentation

https://godoc.org/github.com/jozsefsallai/go-strawpoll

## License

MIT.