From 9ec9b7d142b89b43b3ffd761ccb1b0e11c82b4cf Mon Sep 17 00:00:00 2001 From: Seb Maynard Date: Tue, 31 Oct 2017 20:50:04 +0000 Subject: [PATCH 1/4] Added gift-card-adjustment API --- src/resources/gift-card-adjustment.php | 107 +++++++++++++++++++++++++ src/resources/service-config.php | 1 + 2 files changed, 108 insertions(+) create mode 100644 src/resources/gift-card-adjustment.php diff --git a/src/resources/gift-card-adjustment.php b/src/resources/gift-card-adjustment.php new file mode 100644 index 0000000..9f362b8 --- /dev/null +++ b/src/resources/gift-card-adjustment.php @@ -0,0 +1,107 @@ + array( + + /** + * getGiftCardAdjustments() method + * + * reference: https://help.shopify.com/api/reference/gift_card_adjustment + */ + "getGiftCardAdjustments" => array( + "httpMethod" => "GET", + "uri" => "/admin/gift_cards/{id}/adjustments.json", + "summary" => "Retrieve a list of all Gift Cards Adjustments for a Gift Card", + "responseModel" => "defaultJsonResponse", + "parameters" => array( + "id" => array( + "type" => "number", + "location" => "uri", + "description" => "The ID of the Gift Card.", + "required" => true + ), + "limit" => array( + "type" => "integer", + "location" => "query", + "description" => "Amount of results (default: 50) (maximum: 250)" + ), + "page" => array( + "type" => "integer", + "location" => "query", + "description" => "Page to show (default: 1)" + ), + "fields" => array( + "type" => "string", + "location" => "query", + "description" => "comma-separated list of fields to include in the response" + ) + ) + ), + + /** + * createGiftCardAdjustment() method + * + * reference: https://help.shopify.com/api/reference/gift_card_adjustment + */ + "createGiftCardAdjustment" => array( + "httpMethod" => "POST", + "uri" => "/admin/gift_cards/{id}/adjustments.json", + "summary" => "Create a new Gift Card Adjustment.", + "responseModel" => "defaultJsonResponse", + "parameters" => array( + "id" => array( + "type" => "number", + "location" => "uri", + "description" => "The ID of the Gift Card this adjustment should apply to.", + "required" => true + ), + "adjustment" => array( + "location" => "json", + "parameters" => array( + "amount" => array( + "type" => "string", + "location" => "json", + "description" => "Amount to change the giftcard value by" + ), + "note" => array( + "type" => "string", + "location" => "json", + "description" => "The description of the gift card adjustment." + ), + "processed_at" => array( + "type" => "string", + "location" => "json", + "description" => "The date and time when this adjustment should have been actioned" + ) + ) + ) + ) + ), + + ), + + /* + |-------------------------------------------------------------------------- + | Models + |-------------------------------------------------------------------------- + | + | This array of models is specifications to returning the response + | from the operation methods. + | + */ + + "models" => array( + + ), +); diff --git a/src/resources/service-config.php b/src/resources/service-config.php index dd76efe..ae10c08 100644 --- a/src/resources/service-config.php +++ b/src/resources/service-config.php @@ -53,6 +53,7 @@ "fulfillment", "fulfillment-service", "gift-card", + "gift-card-adjustment", "location", "metafield", "order", From 055b227231ac8c887b1b3d6dfbdd965daba9f429 Mon Sep 17 00:00:00 2001 From: Seb Maynard Date: Tue, 4 Dec 2018 22:36:16 +0000 Subject: [PATCH 2/4] Added inventory-level API --- src/resources/inventory-level.php | 56 +++++++++++++++++++++++++++++++ src/resources/service-config.php | 2 ++ 2 files changed, 58 insertions(+) create mode 100644 src/resources/inventory-level.php diff --git a/src/resources/inventory-level.php b/src/resources/inventory-level.php new file mode 100644 index 0000000..8bf6d21 --- /dev/null +++ b/src/resources/inventory-level.php @@ -0,0 +1,56 @@ + array( + + /** + * getGiftCardAdjustments() method + * + * reference: https://help.shopify.com/api/reference/gift_card_adjustment + */ + "getInventoryLevels" => array( + "httpMethod" => "GET", + "uri" => "/admin/inventory_levels.json", + "summary" => "Retrieve a list of all Gift Cards Adjustments for a Gift Card", + "responseModel" => "defaultJsonResponse", + "parameters" => array( + "inventory_item_ids" => array( + "type" => "string", + "location" => "query", + "description" => "comma-separated list of inventory-item-ids" + ), + "page" => array( + "type" => "integer", + "location" => "query", + "description" => "Page to show (default: 1)" + ), + ) + ), + + ), + + /* + |-------------------------------------------------------------------------- + | Models + |-------------------------------------------------------------------------- + | + | This array of models is specifications to returning the response + | from the operation methods. + | + */ + + "models" => array( + + ), +); diff --git a/src/resources/service-config.php b/src/resources/service-config.php index ae10c08..899b243 100644 --- a/src/resources/service-config.php +++ b/src/resources/service-config.php @@ -54,6 +54,8 @@ "fulfillment-service", "gift-card", "gift-card-adjustment", + /* "inventory-item", */ + "inventory-level", "location", "metafield", "order", From da14d9b93692601912fdaea9c9ca37bed2125501 Mon Sep 17 00:00:00 2001 From: Seb Maynard Date: Thu, 13 Dec 2018 22:44:52 +0000 Subject: [PATCH 3/4] Added more inventory-level API methods --- src/resources/inventory-level.php | 69 ++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/src/resources/inventory-level.php b/src/resources/inventory-level.php index 8bf6d21..7ea711e 100644 --- a/src/resources/inventory-level.php +++ b/src/resources/inventory-level.php @@ -22,7 +22,7 @@ "getInventoryLevels" => array( "httpMethod" => "GET", "uri" => "/admin/inventory_levels.json", - "summary" => "Retrieve a list of all Gift Cards Adjustments for a Gift Card", + "summary" => "Retrieve a list of all inventory levels for the given inventory item ids", "responseModel" => "defaultJsonResponse", "parameters" => array( "inventory_item_ids" => array( @@ -38,6 +38,73 @@ ) ), + "adjustInventoryLevels" => array( + "httpMethod" => "POST", + "uri" => "/admin/inventory_levels/adjust.json", + "summary" => "Adjust an inventory level", + "responseModel" => "defaultJsonResponse", + "parameters" => array( + "location_id" => array( + "type" => "string", + "location" => "json", + "description" => "the location id" + ), + "inventory_item_id" => array( + "type" => "string", + "location" => "json", + "description" => "the inventory item id" + ), + "available_adjustment" => array( + "type" => "string", + "location" => "json", + "description" => "the amount to change the inventory level by" + ), + ) + ), + + "setInventoryLevels" => array( + "httpMethod" => "POST", + "uri" => "/admin/inventory_levels/set.json", + "summary" => "set an inventory level", + "responseModel" => "defaultJsonResponse", + "parameters" => array( + "location_id" => array( + "type" => "string", + "location" => "json", + "description" => "the location id" + ), + "inventory_item_id" => array( + "type" => "string", + "location" => "json", + "description" => "the inventory item id" + ), + "available" => array( + "type" => "string", + "location" => "json", + "description" => "the amount to set the inventory level to" + ), + ) + ), + + "connectInventoryLevels" => array( + "httpMethod" => "POST", + "uri" => "/admin/inventory_levels/connect.json", + "summary" => "Connect a location to an inventory level", + "responseModel" => "defaultJsonResponse", + "parameters" => array( + "location_id" => array( + "type" => "string", + "location" => "json", + "description" => "the location id" + ), + "inventory_item_id" => array( + "type" => "string", + "location" => "json", + "description" => "the inventory item id" + ), + ) + ), + ), /* From 2ad2392cf0a20e088fbba637ea2e83896fe72643 Mon Sep 17 00:00:00 2001 From: Seb Maynard Date: Tue, 18 Dec 2018 20:18:15 +0000 Subject: [PATCH 4/4] Update composer.json Fiddle with guzzlehttp/guzzle-services and guzzlehttp/command --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 777c2a4..ceaa705 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,8 @@ "require": { "php": ">=5.4", "guzzlehttp/guzzle": "~5.3|~6.0", - "guzzlehttp/guzzle-services": "0.5.0", - "guzzlehttp/command": "0.7.0" + "guzzlehttp/guzzle-services": "0.5.0|0.6.0", + "guzzlehttp/command": "0.7.0|0.7.1" }, "autoload": { "psr-4": {