a simple matrix package for basic actions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
569 B

package matrix
import (
"fmt"
"gopkg.in/h2non/gentleman.v2"
"gopkg.in/h2non/gentleman.v2/plugins/query"
)
func join(authinfo Authinfo, roomIdentifier string) error {
cli := gentleman.New()
cli.URL(authinfo.HomeServer)
req := cli.Request()
req.Path(fmt.Sprintf("/_matrix/client/r0/rooms/%s/join", roomIdentifier))
req.Method("POST")
req.Use(query.Set("access_token", authinfo.AccessToken))
res, err := req.Send()
if err != nil {
fmt.Println("ERR1")
return err
}
if !res.Ok {
fmt.Println("ERR2")
fmt.Println(res)
return err
}
return nil
}