go-http-client-wrapper is a tiny go http client wrapper for calling API.
import "github.com/BernardTolosajr/go-http-client-wrapper/client" // with go modules enabled (GO111MODULE=on or
Construct a new default client.
example:
client := client.NewClient("https://api.github.com/", nil)
// GET command with empty parameter
res, _ := client.Get.Call(context.Background(), "users/BernardTolosajr", nil)
// result
//map[avatar_url:https://avatars3.githubusercontent.com/u/3807955?v=4...]
// GET command with parameter
var params = make(map[string]string)
params["foo"] = "baz"
res, _ := client.Get.Call(context.Background(), "somepath", params)
// POST command
sample := &sample{}
res, _ := client.Post.Call(context.Background(), "somepath", sample)
// PUT command
sample := &sample{}
res, _ := client.Put.Call(context.Background(), "somepath/id", sample)
// DELETE command
sample := &sample{}
res, _ := client.Delete.Call(context.Background(), "somepath/id", sample)