You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to request the ability to assign a default value to the $maxTries parameter in REST requests.
Type
New feature
Changes to existing features
Motivation
What inspired this feature request? What problems were you facing?
Currently, when using "Rest resources" to make requests, for example, when calling the save() method on a PHP object derived from the Shopify\Rest\Admin2023_04\Customer class, a default Shopify\Clients\Rest object is created here. Depending on the desired operation and the corresponding HTTP method required, one of the get(), post(), put(), or delete() methods is invoked on this object. Although these methods can accept a $triesparameter, if this parameter is not explicitly provided when calling the relevant method, it is assumed to be null, and a default $maxTries value of 1 is assigned. When we create an object from a "Rest resource" class like Shopify\Rest\Admin2023_04\Customer, we do not directly invoke the get(), post(), put(), or delete() methods ourselves, as the class internally handles this. Therefore, we are unable to pass the $tries parameter ourselves. Consequently, when using "Rest resources," we cannot achieve multiple retries for an operation. If we can assign a default $tries value at some point during the package initialization, for example when setting up the library with Shopify\Context::initialize method, unless we override it, we can ensure that the operation is retried at least that many times.
So we can initialize the Context with something like this:
We are closing this issue because it has been inactive for a few months.
This probably means that it is not reproducible or it has been fixed in a newer version.
If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.
If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines
Overview
I would like to request the ability to assign a default value to the
$maxTries
parameter in REST requests.Type
Motivation
Currently, when using "Rest resources" to make requests, for example, when calling the
save()
method on a PHP object derived from theShopify\Rest\Admin2023_04\Customer
class, a defaultShopify\Clients\Rest
object is created here. Depending on the desired operation and the corresponding HTTP method required, one of theget()
,post()
,put()
, ordelete()
methods is invoked on this object. Although these methods can accept a$tries
parameter, if this parameter is not explicitly provided when calling the relevant method, it is assumed to benull
, and a default$maxTries
value of 1 is assigned. When we create an object from a "Rest resource" class likeShopify\Rest\Admin2023_04\Customer
, we do not directly invoke theget()
,post()
,put()
, ordelete()
methods ourselves, as the class internally handles this. Therefore, we are unable to pass the$tries
parameter ourselves. Consequently, when using "Rest resources," we cannot achieve multiple retries for an operation. If we can assign a default$tries
value at some point during the package initialization, for example when setting up the library withShopify\Context::initialize
method, unless we override it, we can ensure that the operation is retried at least that many times.So we can
initialize
theContext
with something like this:And
request
method ofShopify\Clients\Http
can use this as default value.instead of
Area
Area: <area>
labels to this issueChecklist
The text was updated successfully, but these errors were encountered: