From f76f517db9cdcb87dcc0a245c7f104700c8dd20c Mon Sep 17 00:00:00 2001 From: Chia-Hui Chou Date: Tue, 2 Oct 2018 22:10:42 +0800 Subject: [PATCH] Add product and variant admin_graphql_api_id attribute (#23) * Add storefront access token service * Add product and variant admin_graphql_api_id attribute Signed-off-by: ChouAndy --- fixtures/product.json | 8 ++++--- fixtures/variant.json | 55 ++++++++++++++++++++++--------------------- product.go | 1 + variant.go | 1 + 4 files changed, 35 insertions(+), 30 deletions(-) diff --git a/fixtures/product.json b/fixtures/product.json index 7925f8a0..b85709dd 100644 --- a/fixtures/product.json +++ b/fixtures/product.json @@ -37,7 +37,8 @@ "weight": 0.0, "weight_unit": "lb", "old_inventory_quantity": 1, - "requires_shipping": true + "requires_shipping": true, + "admin_graphql_api_id": "gid://shopify/ProductVariant/1070325219" } ], "options": [ @@ -53,6 +54,7 @@ ], "images": [ ], - "image": null + "image": null, + "admin_graphql_api_id": "gid://shopify/Product/1071559748" } -} \ No newline at end of file +} diff --git a/fixtures/variant.json b/fixtures/variant.json index 087cbf0c..636783e4 100644 --- a/fixtures/variant.json +++ b/fixtures/variant.json @@ -1,29 +1,30 @@ { - "variant": { - "id": 1, - "product_id": 1, - "title": "Yellow", - "price": "1.00", - "sku": "", - "position": 2, - "inventory_policy": "deny", - "compare_at_price": null, - "fulfillment_service": "manual", - "inventory_management": null, - "inventory_item_id": 1, - "option1": "Yellow", - "option2": null, - "option3": null, - "created_at": "2017-10-18T12:22:36-04:00", - "updated_at": "2017-10-18T12:22:36-04:00", - "taxable": true, - "barcode": null, - "grams": 0, - "image_id": null, - "inventory_quantity": 1, - "weight": 0, - "weight_unit": "lb", - "old_inventory_quantity": 1, - "requires_shipping": true - } + "variant": { + "id": 1, + "product_id": 1, + "title": "Yellow", + "price": "1.00", + "sku": "", + "position": 2, + "inventory_policy": "deny", + "compare_at_price": null, + "fulfillment_service": "manual", + "inventory_management": null, + "inventory_item_id": 1, + "option1": "Yellow", + "option2": null, + "option3": null, + "created_at": "2017-10-18T12:22:36-04:00", + "updated_at": "2017-10-18T12:22:36-04:00", + "taxable": true, + "barcode": null, + "grams": 0, + "image_id": null, + "inventory_quantity": 1, + "weight": 0, + "weight_unit": "lb", + "old_inventory_quantity": 1, + "requires_shipping": true, + "admin_graphql_api_id": "gid://shopify/ProductVariant/1" } +} diff --git a/product.go b/product.go index 126f714e..1618de16 100644 --- a/product.go +++ b/product.go @@ -50,6 +50,7 @@ type Product struct { MetafieldsGlobalTitleTag string `json:"metafields_global_title_tag,omitempty"` MetafieldsGlobalDescriptionTag string `json:"metafields_global_description_tag,omitempty"` Metafields []Metafield `json:"metafields,omitempty"` + AdminGraphqlAPIID string `json:"admin_graphql_api_id,omitempty"` } // The options provided by Shopify diff --git a/variant.go b/variant.go index a68f55ad..47a2efdd 100644 --- a/variant.go +++ b/variant.go @@ -54,6 +54,7 @@ type Variant struct { WeightUnit string `json:"weight_unit,omitempty"` OldInventoryQuantity int `json:"old_inventory_quantity,omitempty"` RequireShipping bool `json:"requires_shipping,omitempty"` + AdminGraphqlAPIID string `json:"admin_graphql_api_id,omitempty"` } // VariantResource represents the result from the variants/X.json endpoint