Breaking changes, complete library rewrite.
While the requesting functions and responses are more-less the same, there's a change in initing the library.
Before:
use Gnikyt\BasicShopifyAPI;
$api = new BasicShopifyAPI([true/false], $options);
$api->set...();
Now:
use Gnikyt\BasicShopifyAPI\BasicShopifyAPI;
use Gnikyt\BasicShopifyAPI\Options;
$options = new Options();
$options->set...();
$api = new BasicShopifyAPI($options);
Responses previously was a stdClass
, it is now an array
.
body
value of the response is now also an instance of Gnikyt\BasicShopifyAPI\ResponseAccess
which allows for accessing the decoded JSON as an array or stdClass.
Example:
$response = $api->rest('GET', '/admin/shop.json');
echo $response['body']['name'];
// or
echo $response['body']->name;
- Rate limiting is built-in with defaults
- Retrying requests is now built-in using external middleware which will try requests at default of 2 times
- Shopify's new
X-Retry-After
is respected - Shopify's new REST header for API call limits is respected
No upgrading required.
No upgrading required.
errors
on the resulting object now returns a boolean instead of an object. The body
will not contain the error response.
rest
will remain the same, however, there is now restAsync
which will return a Guzzle promise should you choose to use it.
No upgrading is required if you do not capture 400-500 exceptions from Guzzle yourself. If you do, the library now handles these exceptions internally and returns them inside the resulting object.
getApiCalls()
now takes two arguments, first being rest|graph, second being the key
Old:
getApiCalls('left');
New:
getApiCalls('rest', 'left');
request()
still exists, and is aliased torest()
but encourage you to move all REST calls to the newrest()
method name