Fix usage code in README.md skip ci
parent
b1ec2978a2
commit
82ee148846
38
README.md
38
README.md
|
@ -8,18 +8,32 @@
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```go
|
```go
|
||||||
c := mastodon.NewClient(&mastodon.Config{
|
package main
|
||||||
Server: "https://mstdn.jp",
|
|
||||||
ClientID: "client-id",
|
import (
|
||||||
ClientSecret: "client-secret",
|
"context"
|
||||||
})
|
"fmt"
|
||||||
err := c.Authenticate("your-username", "your-password")
|
"github.com/mattn/go-mastodon"
|
||||||
if err != nil {
|
"log"
|
||||||
log.Fatal(err)
|
)
|
||||||
}
|
|
||||||
timeline, err := c.GetTimelineHome(context.Background())
|
func main() {
|
||||||
if err != nil {
|
c := mastodon.NewClient(&mastodon.Config{
|
||||||
log.Fatal(err)
|
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())
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
for i := len(timeline) - 1; i >= 0; i-- {
|
||||||
|
fmt.Println(timeline[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
## Status of implementations
|
## Status of implementations
|
||||||
|
|
Loading…
Reference in New Issue