go-lemmy/examples/http/main.go

32 lines
467 B
Go
Raw Normal View History

2023-01-08 08:47:32 +00:00
package main
import (
"context"
2023-04-21 02:27:38 +00:00
"go.elara.ws/go-lemmy"
2023-01-08 08:47:32 +00:00
)
func main() {
ctx := context.Background()
c, err := lemmy.New("https://lemmygrad.ml")
if err != nil {
panic(err)
}
err = c.ClientLogin(ctx, lemmy.Login{
2023-01-08 08:47:32 +00:00
UsernameOrEmail: "user@example.com",
Password: `TestPwd`,
})
if err != nil {
panic(err)
}
_, err = c.SaveUserSettings(ctx, lemmy.SaveUserSettings{
BotAccount: lemmy.NewOptional(true),
2023-01-08 08:47:32 +00:00
})
if err != nil {
panic(err)
}
}