r db29c3d874 Add an option to hide unsupported notifications | 3 years ago | |
---|---|---|
.. | ||
LICENSE | 5 years ago | |
README.md | 5 years ago | |
accounts.go | 3 years ago | |
apps.go | 5 years ago | |
filter.go | 3 years ago | |
helper.go | 3 years ago | |
instance.go | 5 years ago | |
lists.go | 5 years ago | |
mastodon.go | 3 years ago | |
notification.go | 3 years ago | |
poll.go | 4 years ago | |
report.go | 5 years ago | |
status.go | 3 years ago | |
streaming.go | 5 years ago | |
unixtime.go | 5 years ago |
package main
import (
"context"
"fmt"
"log"
"github.com/mattn/go-mastodon"
)
func main() {
app, err := mastodon.RegisterApp(context.Background(), &mastodon.AppConfig{
Server: "https://mstdn.jp",
ClientName: "client-name",
Scopes: "read write follow",
Website: "https://github.com/mattn/go-mastodon",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("client-id : %s\n", app.ClientID)
fmt.Printf("client-secret: %s\n", app.ClientSecret)
}
package main
import (
"context"
"fmt"
"log"
"github.com/mattn/go-mastodon"
)
func main() {
c := mastodon.NewClient(&mastodon.Config{
Server: "https://mstdn.jp",
ClientID: "client-id",
ClientSecret: "client-secret",
})
err := c.Authenticate(context.Background(), "your-email", "your-password")
if err != nil {
log.Fatal(err)
}
timeline, err := c.GetTimelineHome(context.Background(), nil)
if err != nil {
log.Fatal(err)
}
for i := len(timeline) - 1; i >= 0; i-- {
fmt.Println(timeline[i])
}
}
$ go get github.com/mattn/go-mastodon
MIT
Yasuhiro Matsumoto (a.k.a. mattn)