Skip to content

Commit

Permalink
int64 --> uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver006 committed Jan 26, 2024
1 parent e1fbfa4 commit 3dd57f3
Show file tree
Hide file tree
Showing 78 changed files with 574 additions and 574 deletions.
6 changes: 3 additions & 3 deletions abandoned_checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type AbandonedCheckoutsResource struct {

// AbandonedCheckout represents a Shopify abandoned checkout
type AbandonedCheckout struct {
Id int64 `json:"id,omitempty"`
Id uint64 `json:"id,omitempty"`
Token string `json:"token,omitempty"`
CartToken string `json:"cart_token,omitempty"`
Email string `json:"email,omitempty"`
Expand All @@ -48,10 +48,10 @@ type AbandonedCheckout struct {
Currency string `json:"currency,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
UserId int64 `json:"user_id,omitempty"`
UserId uint64 `json:"user_id,omitempty"`
SourceIdentifier string `json:"source_identifier,omitempty"`
SourceUrl string `json:"source_url,omitempty"`
DeviceId int64 `json:"device_id,omitempty"`
DeviceId uint64 `json:"device_id,omitempty"`
Phone string `json:"phone,omitempty"`
CustomerLocale string `json:"customer_locale,omitempty"`
Name string `json:"name,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions applicationcharge.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const applicationChargesBasePath = "application_charges"
// See https://help.shopify.com/api/reference/billing/applicationcharge
type ApplicationChargeService interface {
Create(context.Context, ApplicationCharge) (*ApplicationCharge, error)
Get(context.Context, int64, interface{}) (*ApplicationCharge, error)
Get(context.Context, uint64, interface{}) (*ApplicationCharge, error)
List(context.Context, interface{}) ([]ApplicationCharge, error)
Activate(context.Context, ApplicationCharge) (*ApplicationCharge, error)
}
Expand All @@ -25,9 +25,9 @@ type ApplicationChargeServiceOp struct {
}

type ApplicationCharge struct {
Id int64 `json:"id"`
Id uint64 `json:"id"`
Name string `json:"name"`
APIClientId int64 `json:"api_client_id"`
APIClientId uint64 `json:"api_client_id"`
Price *decimal.Decimal `json:"price"`
Status string `json:"status"`
ReturnURL string `json:"return_url"`
Expand Down Expand Up @@ -59,7 +59,7 @@ func (a ApplicationChargeServiceOp) Create(ctx context.Context, charge Applicati
}

// Get gets individual application charge.
func (a ApplicationChargeServiceOp) Get(ctx context.Context, chargeId int64, options interface{}) (*ApplicationCharge, error) {
func (a ApplicationChargeServiceOp) Get(ctx context.Context, chargeId uint64, options interface{}) (*ApplicationCharge, error) {
path := fmt.Sprintf("%s/%d.json", applicationChargesBasePath, chargeId)
resource := &ApplicationChargeResource{}
return resource.Charge, a.client.Get(ctx, path, resource, options)
Expand Down
4 changes: 2 additions & 2 deletions applicationcharge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func applicationChargeTests(t *testing.T, charge ApplicationCharge) {
expected interface{}
actual interface{}
}{
{"Id", int64(1017262355), charge.Id},
{"Id", uint64(1017262355), charge.Id},
{"Name", "Super Duper Expensive action", charge.Name},
{"APIClientId", int64(755357713), charge.APIClientId},
{"APIClientId", uint64(755357713), charge.APIClientId},
{"Price", decimal.NewFromFloat(100.00).String(), charge.Price.String()},
{"Status", "pending", charge.Status},
{"ReturnURL", "http://super-duper.shopifyapps.com/", charge.ReturnURL},
Expand Down
20 changes: 10 additions & 10 deletions asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const assetsBasePath = "themes"
// of the Shopify API.
// See: https://help.shopify.com/api/reference/asset
type AssetService interface {
List(context.Context, int64, interface{}) ([]Asset, error)
Get(context.Context, int64, string) (*Asset, error)
Update(context.Context, int64, Asset) (*Asset, error)
Delete(context.Context, int64, string) error
List(context.Context, uint64, interface{}) ([]Asset, error)
Get(context.Context, uint64, string) (*Asset, error)
Update(context.Context, uint64, Asset) (*Asset, error)
Delete(context.Context, uint64, string) error
}

// AssetServiceOp handles communication with the asset related methods of
Expand All @@ -33,7 +33,7 @@ type Asset struct {
Size int `json:"size,omitempty"`
SourceKey string `json:"source_key,omitempty"`
Src string `json:"src,omitempty"`
ThemeId int64 `json:"theme_id,omitempty"`
ThemeId uint64 `json:"theme_id,omitempty"`
Value string `json:"value,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Expand All @@ -51,19 +51,19 @@ type AssetsResource struct {

type assetGetOptions struct {
Key string `url:"asset[key]"`
ThemeId int64 `url:"theme_id"`
ThemeId uint64 `url:"theme_id"`
}

// List the metadata for all assets in the given theme
func (s *AssetServiceOp) List(ctx context.Context, themeId int64, options interface{}) ([]Asset, error) {
func (s *AssetServiceOp) List(ctx context.Context, themeId uint64, options interface{}) ([]Asset, error) {
path := fmt.Sprintf("%s/%d/assets.json", assetsBasePath, themeId)
resource := new(AssetsResource)
err := s.client.Get(ctx, path, resource, options)
return resource.Assets, err
}

// Get an asset by key from the given theme
func (s *AssetServiceOp) Get(ctx context.Context, themeId int64, key string) (*Asset, error) {
func (s *AssetServiceOp) Get(ctx context.Context, themeId uint64, key string) (*Asset, error) {
path := fmt.Sprintf("%s/%d/assets.json", assetsBasePath, themeId)
options := assetGetOptions{
Key: key,
Expand All @@ -75,7 +75,7 @@ func (s *AssetServiceOp) Get(ctx context.Context, themeId int64, key string) (*A
}

// Update an asset
func (s *AssetServiceOp) Update(ctx context.Context, themeId int64, asset Asset) (*Asset, error) {
func (s *AssetServiceOp) Update(ctx context.Context, themeId uint64, asset Asset) (*Asset, error) {
path := fmt.Sprintf("%s/%d/assets.json", assetsBasePath, themeId)
wrappedData := AssetResource{Asset: &asset}
resource := new(AssetResource)
Expand All @@ -84,7 +84,7 @@ func (s *AssetServiceOp) Update(ctx context.Context, themeId int64, asset Asset)
}

// Delete an asset
func (s *AssetServiceOp) Delete(ctx context.Context, themeId int64, key string) error {
func (s *AssetServiceOp) Delete(ctx context.Context, themeId uint64, key string) error {
path := fmt.Sprintf("%s/%d/assets.json?asset[key]=%s", assetsBasePath, themeId, key)
return s.client.Delete(ctx, path)
}
24 changes: 12 additions & 12 deletions assigned_fulfillment_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ type AssignedFulfillmentOrderService interface {
}

type AssignedFulfillmentOrder struct {
Id int64 `json:"id,omitempty"`
AssignedLocationId int64 `json:"assigned_location_id,omitempty"`
Id uint64 `json:"id,omitempty"`
AssignedLocationId uint64 `json:"assigned_location_id,omitempty"`
Destination AssignedFulfillmentOrderDestination `json:"destination,omitempty"`
LineItems []AssignedFulfillmentOrderLineItem `json:"line_items,omitempty"`
OrderId int64 `json:"order_id,omitempty"`
OrderId uint64 `json:"order_id,omitempty"`
RequestStatus string `json:"request_status,omitempty"`
ShopId int64 `json:"shop_id,omitempty"`
ShopId uint64 `json:"shop_id,omitempty"`
Status string `json:"status,omitempty"`
}

// AssignedFulfillmentOrderDestination represents a destination for a AssignedFulfillmentOrder
type AssignedFulfillmentOrderDestination struct {
Id int64 `json:"id,omitempty"`
Id uint64 `json:"id,omitempty"`
Address1 string `json:"address1,omitempty"`
Address2 string `json:"address2,omitempty"`
City string `json:"city,omitempty"`
Expand All @@ -45,13 +45,13 @@ type AssignedFulfillmentOrderDestination struct {

// AssignedFulfillmentOrderLineItem represents a line item for a AssignedFulfillmentOrder
type AssignedFulfillmentOrderLineItem struct {
Id int64 `json:"id,omitempty"`
ShopId int64 `json:"shop_id,omitempty"`
FulfillmentOrderId int64 `json:"fulfillment_order_id,omitempty"`
LineItemId int64 `json:"line_item_id,omitempty"`
InventoryItemId int64 `json:"inventory_item_id,omitempty"`
Quantity int64 `json:"quantity,omitempty"`
FulfillableQuantity int64 `json:"fulfillable_quantity,omitempty"`
Id uint64 `json:"id,omitempty"`
ShopId uint64 `json:"shop_id,omitempty"`
FulfillmentOrderId uint64 `json:"fulfillment_order_id,omitempty"`
LineItemId uint64 `json:"line_item_id,omitempty"`
InventoryItemId uint64 `json:"inventory_item_id,omitempty"`
Quantity uint64 `json:"quantity,omitempty"`
FulfillableQuantity uint64 `json:"fulfillable_quantity,omitempty"`
}

// AssignedFulfillmentOrderResource represents the result from the assigned_fulfillment_order.json endpoint
Expand Down
2 changes: 1 addition & 1 deletion assigned_fulfillment_order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func AssignedFulfillmentOrderTests(t *testing.T, assignedFulfillmentOrder AssignedFulfillmentOrder) {
// Check that Id is assigned to the returned fulfillment
expectedInt := int64(255858046) // in assigned_fulfillment_orders.json fixture
expectedInt := uint64(255858046) // in assigned_fulfillment_orders.json fixture
if assignedFulfillmentOrder.Id != expectedInt {
t.Errorf("AssignedFulfillmentOrder.Id returned %+v, expected %+v", assignedFulfillmentOrder.Id, expectedInt)
}
Expand Down
10 changes: 5 additions & 5 deletions blog.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ const blogsBasePath = "blogs"
type BlogService interface {
List(context.Context, interface{}) ([]Blog, error)
Count(context.Context, interface{}) (int, error)
Get(context.Context, int64, interface{}) (*Blog, error)
Get(context.Context, uint64, interface{}) (*Blog, error)
Create(context.Context, Blog) (*Blog, error)
Update(context.Context, Blog) (*Blog, error)
Delete(context.Context, int64) error
Delete(context.Context, uint64) error
}

// BlogServiceOp handles communication with the blog related methods of
Expand All @@ -28,7 +28,7 @@ type BlogServiceOp struct {

// Blog represents a Shopify blog
type Blog struct {
Id int64 `json:"id"`
Id uint64 `json:"id"`
Title string `json:"title"`
Commentable string `json:"commentable"`
Feedburner string `json:"feedburner"`
Expand Down Expand Up @@ -67,7 +67,7 @@ func (s *BlogServiceOp) Count(ctx context.Context, options interface{}) (int, er
}

// Get single blog
func (s *BlogServiceOp) Get(ctx context.Context, blogId int64, options interface{}) (*Blog, error) {
func (s *BlogServiceOp) Get(ctx context.Context, blogId uint64, options interface{}) (*Blog, error) {
path := fmt.Sprintf("%s/%d.json", blogsBasePath, blogId)
resource := new(BlogResource)
err := s.client.Get(ctx, path, resource, options)
Expand All @@ -93,6 +93,6 @@ func (s *BlogServiceOp) Update(ctx context.Context, blog Blog) (*Blog, error) {
}

// Delete an blog
func (s *BlogServiceOp) Delete(ctx context.Context, blogId int64) error {
func (s *BlogServiceOp) Delete(ctx context.Context, blogId uint64) error {
return s.client.Delete(ctx, fmt.Sprintf("%s/%d.json", blogsBasePath, blogId))
}
4 changes: 2 additions & 2 deletions blog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func TestBlogCreate(t *testing.T) {
t.Errorf("Blog.Create returned error: %v", err)
}

expectedInt := int64(241253187)
expectedInt := uint64(241253187)
if returnedBlog.Id != expectedInt {
t.Errorf("Blog.Id returned %+v, expected %+v", returnedBlog.Id, expectedInt)
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestBlogUpdate(t *testing.T) {
t.Errorf("Blog.Update returned error: %v", err)
}

expectedInt := int64(241253187)
expectedInt := uint64(241253187)
if returnedBlog.Id != expectedInt {
t.Errorf("Blog.Id returned %+v, expected %+v", returnedBlog.Id, expectedInt)
}
Expand Down
10 changes: 5 additions & 5 deletions carrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const carrierBasePath = "carrier_services"
// See: https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/carrierservice
type CarrierServiceService interface {
List(context.Context) ([]CarrierService, error)
Get(context.Context, int64) (*CarrierService, error)
Get(context.Context, uint64) (*CarrierService, error)
Create(context.Context, CarrierService) (*CarrierService, error)
Update(context.Context, CarrierService) (*CarrierService, error)
Delete(context.Context, int64) error
Delete(context.Context, uint64) error
}

// CarrierServiceOp handles communication with the product related methods of
Expand All @@ -39,7 +39,7 @@ type CarrierService struct {
CarrierServiceType string `json:"carrier_service_type,omitempty"`

// The Id of the carrier service.
Id int64 `json:"id,omitempty"`
Id uint64 `json:"id,omitempty"`

// The format of the data returned by the URL endpoint. Valid values: json and xml. Default value: json.
Format string `json:"format,omitempty"`
Expand Down Expand Up @@ -141,7 +141,7 @@ func (s *CarrierServiceOp) List(ctx context.Context) ([]CarrierService, error) {
}

// Get individual carrier resource by carrier resource Id
func (s *CarrierServiceOp) Get(ctx context.Context, id int64) (*CarrierService, error) {
func (s *CarrierServiceOp) Get(ctx context.Context, id uint64) (*CarrierService, error) {
path := fmt.Sprintf("%s/%d.json", carrierBasePath, id)
resource := new(SingleCarrierResource)
err := s.client.Get(ctx, path, resource, nil)
Expand Down Expand Up @@ -171,6 +171,6 @@ func (s *CarrierServiceOp) Update(ctx context.Context, carrier CarrierService) (
}

// Delete a carrier service
func (s *CarrierServiceOp) Delete(ctx context.Context, id int64) error {
func (s *CarrierServiceOp) Delete(ctx context.Context, id uint64) error {
return s.client.Delete(ctx, fmt.Sprintf("%s/%d.json", carrierBasePath, id))
}
14 changes: 7 additions & 7 deletions collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const collectsBasePath = "collects"
type CollectService interface {
List(context.Context, interface{}) ([]Collect, error)
Count(context.Context, interface{}) (int, error)
Get(context.Context, int64, interface{}) (*Collect, error)
Get(context.Context, uint64, interface{}) (*Collect, error)
Create(context.Context, Collect) (*Collect, error)
Delete(context.Context, int64) error
Delete(context.Context, uint64) error
}

// CollectServiceOp handles communication with the collect related methods of
Expand All @@ -27,9 +27,9 @@ type CollectServiceOp struct {

// Collect represents a Shopify collect
type Collect struct {
Id int64 `json:"id,omitempty"`
CollectionId int64 `json:"collection_id,omitempty"`
ProductId int64 `json:"product_id,omitempty"`
Id uint64 `json:"id,omitempty"`
CollectionId uint64 `json:"collection_id,omitempty"`
ProductId uint64 `json:"product_id,omitempty"`
Featured bool `json:"featured,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Expand Down Expand Up @@ -62,7 +62,7 @@ func (s *CollectServiceOp) Count(ctx context.Context, options interface{}) (int,
}

// Get individual collect
func (s *CollectServiceOp) Get(ctx context.Context, collectId int64, options interface{}) (*Collect, error) {
func (s *CollectServiceOp) Get(ctx context.Context, collectId uint64, options interface{}) (*Collect, error) {
path := fmt.Sprintf("%s/%d.json", collectsBasePath, collectId)
resource := new(CollectResource)
err := s.client.Get(ctx, path, resource, options)
Expand All @@ -79,6 +79,6 @@ func (s *CollectServiceOp) Create(ctx context.Context, collect Collect) (*Collec
}

// Delete an existing collect
func (s *CollectServiceOp) Delete(ctx context.Context, collectId int64) error {
func (s *CollectServiceOp) Delete(ctx context.Context, collectId uint64) error {
return s.client.Delete(ctx, fmt.Sprintf("%s/%d.json", collectsBasePath, collectId))
}
6 changes: 3 additions & 3 deletions collect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func collectTests(t *testing.T, collect Collect) {
expected interface{}
actual interface{}
}{
{"Id", int64(18091352323), collect.Id},
{"CollectionId", int64(241600835), collect.CollectionId},
{"ProductId", int64(6654094787), collect.ProductId},
{"Id", uint64(18091352323), collect.Id},
{"CollectionId", uint64(241600835), collect.CollectionId},
{"ProductId", uint64(6654094787), collect.ProductId},
{"Featured", false, collect.Featured},
{"SortValue", "0000000002", collect.SortValue},
}
Expand Down
14 changes: 7 additions & 7 deletions collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const collectionsBasePath = "collections"
// of the Shopify API.
// See: https://help.shopify.com/api/reference/products/collection
type CollectionService interface {
Get(ctx context.Context, collectionId int64, options interface{}) (*Collection, error)
ListProducts(ctx context.Context, collectionId int64, options interface{}) ([]Product, error)
ListProductsWithPagination(ctx context.Context, collectionId int64, options interface{}) ([]Product, *Pagination, error)
Get(ctx context.Context, collectionId uint64, options interface{}) (*Collection, error)
ListProducts(ctx context.Context, collectionId uint64, options interface{}) ([]Product, error)
ListProductsWithPagination(ctx context.Context, collectionId uint64, options interface{}) ([]Product, *Pagination, error)
}

// CollectionServiceOp handles communication with the collection related methods of
Expand All @@ -25,7 +25,7 @@ type CollectionServiceOp struct {

// Collection represents a Shopify collection
type Collection struct {
Id int64 `json:"id"`
Id uint64 `json:"id"`
Handle string `json:"handle"`
Title string `json:"title"`
UpdatedAt *time.Time `json:"updated_at"`
Expand All @@ -43,15 +43,15 @@ type CollectionResource struct {
}

// Get individual collection
func (s *CollectionServiceOp) Get(ctx context.Context, collectionId int64, options interface{}) (*Collection, error) {
func (s *CollectionServiceOp) Get(ctx context.Context, collectionId uint64, options interface{}) (*Collection, error) {
path := fmt.Sprintf("%s/%d.json", collectionsBasePath, collectionId)
resource := new(CollectionResource)
err := s.client.Get(ctx, path, resource, options)
return resource.Collection, err
}

// List products for a collection
func (s *CollectionServiceOp) ListProducts(ctx context.Context, collectionId int64, options interface{}) ([]Product, error) {
func (s *CollectionServiceOp) ListProducts(ctx context.Context, collectionId uint64, options interface{}) ([]Product, error) {
products, _, err := s.ListProductsWithPagination(ctx, collectionId, options)
if err != nil {
return nil, err
Expand All @@ -60,7 +60,7 @@ func (s *CollectionServiceOp) ListProducts(ctx context.Context, collectionId int
}

// List products for a collection and return pagination to retrieve next/previous results.
func (s *CollectionServiceOp) ListProductsWithPagination(ctx context.Context, collectionId int64, options interface{}) ([]Product, *Pagination, error) {
func (s *CollectionServiceOp) ListProductsWithPagination(ctx context.Context, collectionId uint64, options interface{}) ([]Product, *Pagination, error) {
path := fmt.Sprintf("%s/%d/products.json", collectionsBasePath, collectionId)
resource := new(ProductsResource)

Expand Down
Loading

0 comments on commit 3dd57f3

Please sign in to comment.