README.md
1# go-mastodon
2
3[![Build Status](https://travis-ci.org/mattn/go-mastodon.svg?branch=master)](https://travis-ci.org/mattn/go-mastodon)
4[![Coverage Status](https://coveralls.io/repos/github/mattn/go-mastodon/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-mastodon?branch=master)
5[![GoDoc](https://godoc.org/github.com/mattn/go-mastodon?status.svg)](http://godoc.org/github.com/mattn/go-mastodon)
6[![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-mastodon)](https://goreportcard.com/report/github.com/mattn/go-mastodon)
7
8## Usage
9
10### Application
11
12```go
13package main
14
15import (
16 "context"
17 "fmt"
18 "log"
19
20 "github.com/mattn/go-mastodon"
21)
22
23func main() {
24 app, err := mastodon.RegisterApp(context.Background(), &mastodon.AppConfig{
25 Server: "https://mstdn.jp",
26 ClientName: "client-name",
27 Scopes: "read write follow",
28 Website: "https://github.com/mattn/go-mastodon",
29 })
30 if err != nil {
31 log.Fatal(err)
32 }
33 fmt.Printf("client-id : %s\n", app.ClientID)
34 fmt.Printf("client-secret: %s\n", app.ClientSecret)
35}
36```
37
38### Client
39
40```go
41package main
42
43import (
44 "context"
45 "fmt"
46 "log"
47
48 "github.com/mattn/go-mastodon"
49)
50
51func main() {
52 c := mastodon.NewClient(&mastodon.Config{
53 Server: "https://mstdn.jp",
54 ClientID: "client-id",
55 ClientSecret: "client-secret",
56 })
57 err := c.Authenticate(context.Background(), "your-email", "your-password")
58 if err != nil {
59 log.Fatal(err)
60 }
61 timeline, err := c.GetTimelineHome(context.Background(), nil)
62 if err != nil {
63 log.Fatal(err)
64 }
65 for i := len(timeline) - 1; i >= 0; i-- {
66 fmt.Println(timeline[i])
67 }
68}
69```
70
71## Status of implementations
72
73* [x] GET /api/v1/accounts/:id
74* [x] GET /api/v1/accounts/verify_credentials
75* [x] PATCH /api/v1/accounts/update_credentials
76* [x] GET /api/v1/accounts/:id/followers
77* [x] GET /api/v1/accounts/:id/following
78* [x] GET /api/v1/accounts/:id/statuses
79* [x] POST /api/v1/accounts/:id/follow
80* [x] POST /api/v1/accounts/:id/unfollow
81* [x] GET /api/v1/accounts/:id/block
82* [x] GET /api/v1/accounts/:id/unblock
83* [x] GET /api/v1/accounts/:id/mute
84* [x] GET /api/v1/accounts/:id/unmute
85* [ ] GET /api/v1/accounts/:id/lists
86* [x] GET /api/v1/accounts/relationships
87* [x] GET /api/v1/accounts/search
88* [x] POST /api/v1/apps
89* [x] GET /api/v1/blocks
90* [x] GET /api/v1/favourites
91* [x] GET /api/v1/follow_requests
92* [x] POST /api/v1/follow_requests/:id/authorize
93* [x] POST /api/v1/follow_requests/:id/reject
94* [x] POST /api/v1/follows
95* [x] GET /api/v1/instance
96* [x] GET /api/v1/instance/activity
97* [x] GET /api/v1/instance/peers
98* [ ] GET /api/v1/lists
99* [ ] GET /api/v1/lists/:id/accounts
100* [ ] GET /api/v1/lists/:id
101* [ ] POST /api/v1/lists
102* [ ] PUT /api/v1/lists/:id
103* [ ] DELETE /api/v1/lists/:id
104* [ ] POST /api/v1/lists/:id/accounts
105* [ ] DELETE /api/v1/lists/:id/accounts
106* [x] POST /api/v1/media
107* [x] GET /api/v1/mutes
108* [x] GET /api/v1/notifications
109* [x] GET /api/v1/notifications/:id
110* [x] POST /api/v1/notifications/clear
111* [x] GET /api/v1/reports
112* [x] POST /api/v1/reports
113* [x] GET /api/v1/search
114* [x] GET /api/v1/statuses/:id
115* [x] GET /api/v1/statuses/:id/context
116* [x] GET /api/v1/statuses/:id/card
117* [x] GET /api/v1/statuses/:id/reblogged_by
118* [x] GET /api/v1/statuses/:id/favourited_by
119* [x] POST /api/v1/statuses
120* [x] DELETE /api/v1/statuses/:id
121* [x] POST /api/v1/statuses/:id/reblog
122* [x] POST /api/v1/statuses/:id/unreblog
123* [x] POST /api/v1/statuses/:id/favourite
124* [x] POST /api/v1/statuses/:id/unfavourite
125* [x] GET /api/v1/timelines/home
126* [x] GET /api/v1/timelines/public
127* [x] GET /api/v1/timelines/tag/:hashtag
128
129## Installation
130
131```
132$ go get github.com/mattn/go-mastodon
133```
134
135## License
136
137MIT
138
139## Author
140
141Yasuhiro Matsumoto (a.k.a. mattn)
142