about summary refs log tree commit diff
path: root/example/basic/main.go
blob: fd802eac43296216de8d0f6e8ca8206fde1c0754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
}