Skip to content

botscommunity/botsgo

Repository files navigation

Preview

User-friendly module for communication with external API

Installation

go get github.com/botscommunity/botsgo

Getting Started

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)
	}
}

Help in solving problems

Join our friendly community where we collaborate on bot development. Feel free to ask questions in our chat rooms and share your thoughts.