Skip to content

andrew-waters/gomo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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/andrew-waters/gomo

Documentation

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

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 suply a client_id and 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