go-lemmy/README.md

31 lines
573 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://lemmygrad.ml")
2022-12-10 17:17:16 +00:00
if err != nil {
panic(err)
2022-12-10 17:17:16 +00:00
}
err = c.ClientLogin(ctx, types.Login{
UsernameOrEmail: "user@example.com",
Password: `TestPwd`,
2022-12-10 17:17:16 +00:00
})
if err != nil {
panic(err)
2022-12-10 17:17:16 +00:00
}
_, err = c.SaveUserSettings(ctx, types.SaveUserSettings{
BotAccount: types.NewOptional(true),
2022-12-10 17:17:16 +00:00
})
if err != nil {
panic(err)
2022-12-10 17:17:16 +00:00
}
```