diff options
Diffstat (limited to 'example/basic')
-rw-r--r-- | example/basic/go.mod | 12 | ||||
-rw-r--r-- | example/basic/go.sum | 13 | ||||
-rw-r--r-- | example/basic/main.go | 29 |
3 files changed, 54 insertions, 0 deletions
diff --git a/example/basic/go.mod b/example/basic/go.mod new file mode 100644 index 0000000..c5a9de2 --- /dev/null +++ b/example/basic/go.mod @@ -0,0 +1,12 @@ +module git.darknebu.la/emile/matrix/example/basic + +go 1.13 + +replace git.darknebu.la/emile/matrix => ../../ + +require ( + git.darknebu.la/emile/matrix v0.0.0-00010101000000-000000000000 + github.com/h2non/gentleman v2.0.4+incompatible // indirect + golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect + gopkg.in/h2non/gentleman.v2 v2.0.4 // indirect +) diff --git a/example/basic/go.sum b/example/basic/go.sum new file mode 100644 index 0000000..86c028c --- /dev/null +++ b/example/basic/go.sum @@ -0,0 +1,13 @@ +github.com/h2non/gentleman v2.0.4+incompatible h1:C5vcqSVYEmc1aJcK7biWLfEmTFRbbvwjsWEFS7y6J+E= +github.com/h2non/gentleman v2.0.4+incompatible/go.mod h1:ddrWLQr62qU8EOGml9CArC88lNeDkYPmysfWX1PUKK4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +gopkg.in/h2non/gentleman.v2 v2.0.4 h1:9R3K6CFYd/RdXDLi0pGXwaPnRx/pn5EZlrN3VkNygWc= +gopkg.in/h2non/gentleman.v2 v2.0.4/go.mod h1:A1c7zwrTgAyyf6AbpvVksYtBayTB4STBUGmdkEtlHeA= 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) +} |