# README
go-shopify-graphql
Preface: This is a fork from https://github.com/r0busta/go-shopify-graphql which extended features (retry capability, optionally set timeout, transport)
A simple client using the Shopify GraphQL Admin API.
Getting started
Hello World example
0. Setup
export STORE_API_KEY=<private_app_api_key>
export STORE_PASSWORD=<private_app_access_token>
export STORE_NAME=<store_name>
1. Program
package main
import (
"context"
"fmt"
"os"
shopify "github.com/vinhluan/go-shopify-graphql"
)
func main() {
// Create client
client := shopify.NewDefaultClient()
// Or if you are a fan of options
client = shopify.NewClient(os.Getenv("STORE_NAME"),
shopify.WithToken(os.Getenv("STORE_PASSWORD")),
shopify.WithVersion("2023-07"),
shopify.WithRetries(5))
// Get all collections
collections, err := client.Collection.ListAll(context.Background())
if err != nil {
panic(err)
}
// Print out the result
for _, c := range collections {
fmt.Println(c.Handle)
}
}
3. Run
go run .
# Functions
CalculateWaitTime returns a duration needed to wait in order to avoid reaching rate limit.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
WithPrivateAppAuth optionally sets private app credentials (API key and access token).
WithRetries optionally sets maximum retry count for an API call.
WithTimeout optionally sets timeout for each HTTP requests made.
WithToken optionally sets access token.
WithTransport optionally sets transport for HTTP client.
WithVersion optionally sets the API version if the passed string is valid.
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
go:generate mockgen -destination=./mock/bulk_service.go -package=mock .
go:generate mockgen -destination=./mock/collection_service.go -package=mock .
go:generate mockgen -destination=./mock/fulfillment_service.go -package=mock .
go:generate mockgen -destination=./mock/inventory_service.go -package=mock .
go:generate mockgen -destination=./mock/location_service.go -package=mock .
go:generate mockgen -destination=./mock/metafield_service.go -package=mock .
go:generate mockgen -destination=./mock/order_service.go -package=mock .
go:generate mockgen -destination=./mock/product_service.go -package=mock .
go:generate mockgen -destination=./mock/variant_service.go -package=mock .
No description provided by the author
# Type aliases
No description provided by the author