Skip to content
/ gomo Public
forked from andrew-waters/gomo

A Go client for the Moltin API

License

Notifications You must be signed in to change notification settings

moltin/gomo

 
 

Repository files navigation

gomo - a Go Client for the Moltin API

GoDoc Report Card Maintainability Test Coverage

A Golang client for the moltin API.

go get github.com/moltin/gomo

Documentation

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))

Testing

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.

About

A Go client for the Moltin API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%