• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cmd/mstdn/H25-Nov-2018-1,7671,567

testdata/H03-May-2022-

.gitignoreH A D25-Nov-20186 21

.travis.ymlH A D25-Nov-2018205 98

LICENSEH A D25-Nov-20181 KiB2217

README.mdH A D25-Nov-20183.6 KiB142121

accounts.goH A D25-Nov-20189 KiB282224

accounts_test.goH A D25-Nov-201817.9 KiB673631

apps.goH A D25-Nov-20182.5 KiB9772

apps_test.goH A D25-Nov-20182.4 KiB9986

compat.goH A D25-Nov-2018417 2622

example_test.goH A D25-Nov-20181.4 KiB6862

helper.goH A D25-Nov-20181.2 KiB5642

helper_test.goH A D25-Nov-20184.1 KiB9072

instance.goH A D25-Nov-20182 KiB6652

instance_test.goH A D25-Nov-20185.2 KiB177167

mastodon.goH A D25-Nov-20187 KiB320267

mastodon_test.goH A D25-Nov-20188.9 KiB362329

notification.goH A D25-Nov-20181.2 KiB4333

notification_test.goH A D25-Nov-20181.4 KiB6056

report.goH A D25-Nov-2018951 4032

report_test.goH A D25-Nov-20182.3 KiB9387

status.goH A D25-Nov-20188.6 KiB277228

status_test.goH A D25-Nov-201815.1 KiB553518

streaming.goH A D25-Nov-20183.3 KiB159126

streaming_test.goH A D25-Nov-20187 KiB296279

streaming_ws.goH A D25-Nov-20183.8 KiB191149

streaming_ws_test.goH A D25-Nov-20187.2 KiB282243

unixtime.goH A D25-Nov-2018359 2117

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