This repository contains implementation of some core go libs
go get github.com/vithubati/go-core
- Add core module to import statement.
import "github.com/vithubati/go -core/<package>
- Creat an authenticator for the client
authenticator, err := NewBasicAuthenticator ( "username", "password")
- Creating a client
auth, _ := authenticator.NewBearerTokenAuthenticator("Test-TOKEN")
client := New(WithAuthenticator(auth))
- Creating a request
auth, _ := authenticator.NewBearerTokenAuthenticator("Test-TOKEN")
client := New(WithAuthenticator(auth))
params := url.Values{}
params.Set("limit", "5")
params.Set("size", "10")
ctx := context.Background()
url := "https://gobyexample.com/"
req := client.RequestWithCtx(ctx, url, http.MethodGet, nil, params)
- Executing a request
resp, err := client.Execute(req)