func NewClient(baseURL, key, secret string) (*Client, error) {
	baseURL, err := formatURL(baseURL)
	if err != nil {
		return nil, err
	}
	var netTransport = &http.Transport{
		Dial: (&net.Dialer{
			Timeout: 10 * time.Second,
		}).Dial,
		TLSHandshakeTimeout: 10 * time.Second,
	}
	return &Client{
		baseURL: baseURL,
		key:     strings.TrimSpace(key),
		secret:  strings.TrimSpace(secret),
		client: &http.Client{
			Timeout: time.Second * 30,
			Transport: &rateLimitedTransport{
				delegate: netTransport,
				throttle: time.Now().Add(-(rateLimit)),
			},
		},
	}, nil
}
NewClient constructs a new GoDaddy API client or an error if the supplied
input is invalid.
package api
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net"
	"net/http"
	"net/url"
	"strings"
	"sync"
	"time"
)
const (
	headerAccept        = "Accept"
	headerAuthorization = "Authorization"
	headerContent       = "Content-Type"
	headerCustomerID    = "X-Shopper-Id"
	mediaTypeJSON       = "application/json"
	rateLimit           = 1 * time.Second
)
type Client struct {
	baseURL string
	key     string
	secret  string
	client  *http.Client
}
type rateLimitedTransport struct {
	delegate http.RoundTripper
	throttle time.Time
	sync.Mutex
}
func (t *rateLimitedTransport) RoundTrip(req *http.Request) (*http.Response, error) {
	t.Lock()
	defer t.Unlock()
	if t.throttle.After(time.Now()) {
		delta := t.throttle.Sub(time.Now())
		time.Sleep(delta)
	}
	t.throttle = time.Now().Add(rateLimit)
	return t.delegate.RoundTrip(req)
}