go-lemmy/README.md

31 lines
582 B
Markdown
Raw Normal View History

2022-12-10 17:17:16 +00:00
# Go-Lemmy
2022-12-10 17:52:09 +00:00
[![Go Reference](https://pkg.go.dev/badge/go.arsenm.dev/go-lemmy.svg)](https://pkg.go.dev/go.arsenm.dev/go-lemmy)
2022-12-10 17:17:16 +00:00
Go bindings to the [Lemmy](https://join-lemmy.org) API
Example:
```go
ctx := context.Background()
c, err := lemmy.New("https://lemmy.ml")
if err != nil {
panic(err)
}
err = c.Login(ctx, types.Login{
UsernameOrEmail: "email@example.com",
Password: `TestPwd`,
})
if err != nil {
panic(err)
}
_, err = c.SaveUserSettings(ctx, types.SaveUserSettings{
BotAccount: types.NewOptional(true),
})
if err != nil {
panic(err)
}
```