Golang library for interacting with Namecheap's API. GoDoc
$ go get github.com/adamdecaf/namecheap
Generally callers would create a namecheap.Client
and make calls off of that.
import (
"github.com/adamdecaf/namecheap"
)
// Reads environment variables
client, err := namecheap.New()
// Directly build client
client, err := namecheap.NewClient(username, apiuser string, token string, ip string, useSandbox)
Calling namecheap.New()
reads the following environment variables:
NAMECHEAP_USERNAME
: Username: e.g. adamdecafNAMECHEAP_API_USER
: ApiUser: e.g. adamdecafNAMECHEAP_TOKEN
: From https://ap.www.namecheap.com/Profile/Tools/ApiAccessNAMECHEAP_IP
: Your IP (must be whitelisted)NAMECHEAP_USE_SANDBOX
: Use sandbox environment
I appreciate feedback, issues and Pull Requests. You can build the project with make build
in the root and run tests with make test
.
If you're looking to run tests yourself you can configure the environmental variables and override the test records in client_test.go
. (To make live api calls) Otherwise only mockable tests will run.
The following are contributor oriented environmental variables:
DEBUG
: Log all responsesMOCKED
: Force disabletestClient