A Golang client for the moltin API.
go get github.com/moltin/gomo
Reference documentation is available on GoDoc.
client := gomo.NewClient(
gomo.ClientCredentials(
os.Getenv("MOLTIN_CLIENT_ID"),
os.Getenv("MOLTIN_CLIENT_SECRET"),
),
)
if err := client.Authenticate(); err != nil {
log.Fatal(err)
}
products := []entities.Product{}
err := client.Get("products", gomo.Data(&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 supply a MOLTIN_CLIENT_ID
and MOLTIN_CLIENT_SECRET
, we will
skip tests that leverage the live API.