User-friendly module for communication with external API
go get github.com/botscommunity/botsgo
package main
import (
"context"
"github.com/botscommunity/botsgo"
"net/http"
)
func main() {
client, err := botsgo.NewClient("$URL")
if err != nil {
panic(err)
}
req, err := client.NewRequest(context.TODO())
if err != nil {
panic(err)
}
response := struct{}{}
req.Method(http.MethodGet)
req.Path("/$path")
req.SetHeader("Authorization", "Bearer $TOKEN")
req.Response(&response)
res, err := req.Do()
if err != nil {
panic(err)
}
if err := res.Body.Close(); err != nil {
panic(err)
}
}
Join our friendly community where we collaborate on bot development. Feel free to ask questions in our chat rooms and share your thoughts.