Skip to content

Conversation

Spotnyk
Copy link
Contributor

@Spotnyk Spotnyk commented May 29, 2023

This PR attempts to support resource/object level data keys as well as request level.

As example:
The recently added AssignedFulfillmentOrder resource. It returns results with the fulfillment_orders key, which does not match the resource key.

While a data key can be manually passed to get(), it feels messy for a resource which always requires a custom data key.

Setting the protected $dataKey property in a resource object will cause the specified key to be used with results (unless a key is provided manually).

(Therefore, this PR "fixes" the response payload from AssignedFulfillmentOrder)

@Spotnyk
Copy link
Contributor Author

Spotnyk commented May 31, 2023

As a "quick glance" example of what this fixes:

Currently (at every implementation point):

$shopify->AssignedFulfillmentOrders->get(['assignment_status' => 'in_progress'], null, 'fulfillment_orders');

WIth change:
Resource (once):

protected $dataKey = 'fulfillment_orders';

Runtime:

$shopify->AssignedFulfillmentOrders->get(['assignment_status' => 'in_progress']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant