~thrrgilag/woodstock

woodstock/examples/post.go -rw-r--r-- 415 bytes
62b10b5cMorgan McMillian Update for new project location and module name 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main

import (
	"fmt"
	"net/url"

	"mcmillian.dev/go/woodstock"
)

const (
	CLIENT_ID     = "client id"
	CLIENT_SECRET = "client secret"
	ACCESS_TOKEN  = "access token"
)

func main() {
	client := woodstock.NewClient(CLIENT_ID, CLIENT_SECRET)
	client.SetAccessToken(ACCESS_TOKEN)
	v := url.Values{}
	v.Set("text", "Hello pnut.io")
	_, err := client.Post(v)
	if err != nil {
		fmt.Println(err)
		return
	}
}