Skip to content

Commit

Permalink
Address bold-commerce#89 - SinceID as Zero and omitempty
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver006 committed Jan 22, 2024
1 parent e07af64 commit 41098e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion collect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ func TestCollectCount(t *testing.T) {
t.Errorf("Collect.Count returned %d, expected %d", cnt, expected)
}

cnt, err = client.Collect.Count(ListOptions{SinceId: 123})
sinceId := uint64(123)
cnt, err = client.Collect.Count(ListOptions{SinceId: &sinceId})
if err != nil {
t.Errorf("Collect.Count returned error: %v", err)
}
Expand Down
3 changes: 2 additions & 1 deletion collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,13 @@ func TestListProductsWithPagination(t *testing.T) {
t.Errorf("Collection.ListProductsWithPagination returned %+v, expected %+v", products, expectedProducts)
}

sinceId := uint64(0)
expectedPage := &Pagination{
NextPageOptions: &ListOptions{
PageInfo: "pageInfoCode",
Page: 0,
Limit: 1,
SinceId: 0,
SinceId: &sinceId,
CreatedAtMin: time.Time{},
CreatedAtMax: time.Time{},
UpdatedAtMin: time.Time{},
Expand Down
2 changes: 1 addition & 1 deletion goshopify.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ type ListOptions struct {
// It is the deprecated way to do pagination.
Page int `url:"page,omitempty"`
Limit int `url:"limit,omitempty"`
SinceId uint64 `url:"since_id,omitempty"`
SinceId *uint64 `url:"since_id,omitempty"`
CreatedAtMin time.Time `url:"created_at_min,omitempty"`
CreatedAtMax time.Time `url:"created_at_max,omitempty"`
UpdatedAtMin time.Time `url:"updated_at_min,omitempty"`
Expand Down

0 comments on commit 41098e0

Please sign in to comment.