about summary refs log tree commit diff
path: root/example/basic/main.go
diff options
context:
space:
mode:
authorhanemile <mail@emile.space>2020-07-09 19:54:39 +0200
committerhanemile <mail@emile.space>2020-07-09 19:54:39 +0200
commitb43e5d69d2afa86db1eb5bca20307a1e32ef6dd6 (patch)
tree78fdc7791796d1992671d09d7ce5e61273fe2867 /example/basic/main.go
initial commit
Diffstat (limited to 'example/basic/main.go')
-rw-r--r--example/basic/main.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/example/basic/main.go b/example/basic/main.go
new file mode 100644
index 0000000..fd802ea
--- /dev/null
+++ b/example/basic/main.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+	"fmt"
+
+	"git.darknebu.la/emile/matrix"
+)
+
+func main() {
+	fmt.Println("Basic example")
+
+	username := "testbot1"
+	password := "testbot1"
+	homeserver := "https://matrix.emile.space"
+
+	authinfo, err := matrix.Login(username, password, homeserver)
+	if err != nil {
+		fmt.Println("ERROR")
+		fmt.Println(err)
+		return
+	}
+
+	fmt.Printf("UserID %v\n", authinfo.UserID)
+	fmt.Printf("HomeServer %v\n", authinfo.HomeServer)
+	fmt.Printf("DeviceID %v\n", authinfo.DeviceID)
+	fmt.Printf("AccessToken %v\n", authinfo.AccessToken)
+
+	matrix.Sync(authinfo)
+}