Move examples to examples directory
This commit is contained in:
32
examples/http/main.go
Normal file
32
examples/http/main.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.arsenm.dev/go-lemmy"
|
||||
"go.arsenm.dev/go-lemmy/types"
|
||||
)
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user