Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added gift-card-adjustment API #70

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
107 changes: 107 additions & 0 deletions src/resources/gift-card-adjustment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php

return array(

/*
|--------------------------------------------------------------------------
| Operations
|--------------------------------------------------------------------------
|
| This array of operations is translated into methods that complete these
| requests based on their configuration.
|
*/

"operations" => 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(

),
);
123 changes: 123 additions & 0 deletions src/resources/inventory-level.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?php

return array(

/*
|--------------------------------------------------------------------------
| Operations
|--------------------------------------------------------------------------
|
| This array of operations is translated into methods that complete these
| requests based on their configuration.
|
*/

"operations" => 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 inventory levels for the given inventory item ids",
"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)"
),
)
),

"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"
),
)
),

),

/*
|--------------------------------------------------------------------------
| Models
|--------------------------------------------------------------------------
|
| This array of models is specifications to returning the response
| from the operation methods.
|
*/

"models" => array(

),
);
3 changes: 3 additions & 0 deletions src/resources/service-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
"fulfillment",
"fulfillment-service",
"gift-card",
"gift-card-adjustment",
/* "inventory-item", */
"inventory-level",
"location",
"metafield",
"order",
Expand Down