This library provides wrapper functions for Sendbird Platform API written in Golang and support following Sendbird APIs:
- Go 1.5 or later.
- Sendbird API Key.
To install SendbirdClient for Golang, please execute the following go get
command.
go get github.com/blazingorb/sendbirdclient
Sample Usage of creating a new Sendbird User:
package main
import (
"flag"
"fmt"
sendbirdclient "sendbirdclient"
)
const (
IssueAccessToken = false
IsDistinct = true
)
var (
apiKey = flag.String("key", "", "API Key for using Sendbird Platform API")
userID = flag.String("id", "", "UserID for creating a new user")
nickName = flag.String("name", "", "Nickname for creating a new user")
)
func main() {
flag.Parse()
testClient, err := sendbirdclient.NewClient(sendbirdclient.WithAPIKey(*apiKey))
check(err)
user, err := testClient.CreateAUserWithURL(&sendbirdclient.CreateAUserWithURLRequest{
UserID: *userID,
NickName: *nickName,
IssueAccessToken: IssueAccessToken,
})
check(err)
fmt.Printf("User: %+v \n", user)
}
func check(err error) {
if err != nil {
fmt.Println(err)
panic(err)
}
}
For more detail sample cases, please refer to files under examples folder.