Created
September 26, 2020 19:23
-
-
Save gordcurrie/0a6b2c75375734d8e65e008a3ca47851 to your computer and use it in GitHub Desktop.
An example for customers, which has not implemented a ListWithPagniation function yet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Important note, initial SinceID must me set to 1, not 0 as 0 will
omitemptyand leave the param out entirely.