A Golang client for the moltin API.
go get github.com/andrew-waters/gomo
Code documentation is available on GoDoc.
A guide is avilable on the wiki, but the demo below shows you how to create a client and get some products:
client := gomo.NewClient(
gomo.NewClientCredentials(
os.Getenv("CLIENT_ID"),
os.Getenv("CLIENT_SECRET"),
),
)
if err := client.Authenticate(); err != nil {
log.Fatal(err)
}
products := []entities.Product{}
_, err := client.Get("products", &products)
if err != nil {
log.Fatal(err)
}
log.Printf("Found %d products\n", len(products))
In order to fully test the package, you will need a Moltin account to add your credentials to an environment file:
cp .env.example .env
Add your credentials and run:
source .env && go test ./...
If you do not suply a client_id and client_secret, we will skip tests that leverage the live API.