go-lemmy/examples/http/main.go

33 lines
497 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"
"go.elara.ws/go-lemmy/types"
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, types.Login{
UsernameOrEmail: "user@example.com",
Password: `TestPwd`,
})
if err != nil {
panic(err)
}
_, err = c.SaveUserSettings(ctx, types.SaveUserSettings{
BotAccount: types.NewOptional(true),
})
if err != nil {
panic(err)
}
}