Skip to content

Instantly share code, notes, and snippets.

@gordcurrie
Created September 26, 2020 19:23
Show Gist options
  • Select an option

  • Save gordcurrie/0a6b2c75375734d8e65e008a3ca47851 to your computer and use it in GitHub Desktop.

Select an option

Save gordcurrie/0a6b2c75375734d8e65e008a3ca47851 to your computer and use it in GitHub Desktop.
An example for customers, which has not implemented a ListWithPagniation function yet.
package main
import (
"fmt"
goshopify "github.com/bold-commerce/go-shopify/v3"
)
func main() {
client := goshopify.NewClient(goshopify.App{}, "SHOP_NAME", "API_TOKEN", goshopify.WithVersion("2020-01"))
c, err := client.Customer.List(goshopify.ListOptions{SinceID: 1, Limit: 5})
if err != nil {
fmt.Printf("Error: %s", err.Error())
}
fmt.Println("#############First Call#################")
fmt.Printf("%+v\n", c)
c, err = client.Customer.List(goshopify.ListOptions{SinceID: c[len(c)-1].ID, Limit: 5})
if err != nil {
fmt.Printf("Error: %s", err.Error())
}
// fmt.Printf("%+v", p)
fmt.Println("#############Second Call#################")
fmt.Printf("%+v", c)
}
@gordcurrie
Copy link
Author

Important note, initial SinceID must me set to 1, not 0 as 0 will omitempty and leave the param out entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment