Skip to content
A Go client for the Moltin API
Go
Branch: master
Clone or download
Pull request Compare This branch is 109 commits ahead of andrew-waters:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
core
examples
form
internal/generators
.env.example
.gitignore
LICENSE
README.md
client.go
client_authenticate.go
client_authenticate_test.go
client_options.go
client_requests.go
client_requests_test.go
client_test.go
credentials.go
credentials_client.go
credentials_client_test.go
credentials_implicit.go
credentials_implicit_test.go
doc.go
doc_test.go
go.mod
go.sum
paginate.go
paginate_test.go
request_options.go
request_options_test.go
wrapper.go
wrapper_error.go
wrapper_error_test.go
wrapper_execution.go
wrapper_execution_test.go
wrapper_test.go

README.md

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.

You can’t perform that action at this time.