slince / shopify-api-php

:rocket: Shopify API Client for PHP
MIT License
128 stars 48 forks source link

Asset manager #7

Closed maximzasorin closed 6 years ago

maximzasorin commented 6 years ago

Hello, I tried using AssetManager to get and edit an asset of the theme, but looks like it does not work, I can not get and edit single asset.

Asset resource API stands apart from other: https://help.shopify.com/en/api/reference/online_store/asset, it does not have id, but identified by the key, asset does not have particular method for creating resources (only for create or update), asset does not have /count resource. I think we need to remake AssetManager.

maximzasorin commented 6 years ago

I added PR for improve asset manager:

// Get all assets
$assetManager->findAll($themeId);

// Get single asset
$assetManager->find($themeId, 'layout/theme.liquid');

// Create/Update asset
$assetManager->update($themeId, [
    'key' => 'layout/alternate.liquid',
    'source_key' => 'layout/theme.liquid'
];

// Remove asset
$assetManager->remove($themeId, 'assets/bg-body.gif');
slince commented 6 years ago

thk. it is my mistake; I didn't use this feature in my project, so I didn't verify it.

slince commented 6 years ago

I have released a new version.