This package provides a generic go client template for an HTTP API
go-http-client is compatible with modern Go releases in module mode, with Go installed:
go get github.com/NdoleStudio/go-http-clientAlternatively the same can be achieved if you use import in a package:
import "github.com/NdoleStudio/go-http-client"- Status Codes
GET /200: OK
An instance of the client can be created using New().
package main
import (
"github.com/NdoleStudio/go-http-client"
)
func main() {
statusClient := client.New(client.WithDelay(200))
}All API calls return an error as the last return object. All successful calls will return a nil error.
status, response, err := statusClient.Status.Ok(context.Background())
if err != nil {
//handle error
}status, response, err := statusClient.Status.Ok(context.Background())
if err != nil {
log.Fatal(err)
}
log.Println(status.Description) // OKYou can run the unit tests for this client from the root directory using the command below:
go test -vThis project is licensed under the MIT License - see the LICENSE file for details
