diff --git a/CHANGELOG.md b/CHANGELOG.md index f8a5709..aca7cb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.3.0 + +* Added new endpoint for accessing articles without the blog reference. + # 1.2.0 * Add support for usage charge methods (https://help.shopify.com/api/reference/usagecharge) diff --git a/README.md b/README.md index 4a7f9e2..161c562 100644 --- a/README.md +++ b/README.md @@ -198,8 +198,11 @@ Here is a list of supported endpoints (more to come in the future): * getArticlesAuthors(array $args = []) * getArticlesTags(array $args = []) * createArticle(array $args = []) +* createBlogArticle(array $args = []) * updateArticle(array $args = []) +* updateBlogArticle(array $args = []) * deleteArticle(array $args = []) +* deleteBlogArticle(array $args = []) **ASSET RELATED METHODS:** diff --git a/src/ServiceDescription/Shopify-v1.php b/src/ServiceDescription/Shopify-v1.php index 5a89539..8f451f1 100644 --- a/src/ServiceDescription/Shopify-v1.php +++ b/src/ServiceDescription/Shopify-v1.php @@ -301,6 +301,75 @@ ], 'CreateArticle' => [ + 'httpMethod' => 'POST', + 'uri' => 'articles.json', + 'summary' => 'Create a new article', + 'data' => ['root_key' => 'article'], + 'parameters' => [ + 'title' => [ + 'description' => 'Article title', + 'location' => 'json', + 'type' => 'string', + 'required' => true + ], + 'author' => [ + 'description' => 'Author for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'tags' => [ + 'description' => 'Tags for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'body_html' => [ + 'description' => 'HTML content for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'summary_html' => [ + 'description' => 'HTML content for the article\'s summary', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'handle' => [ + 'description' => 'Handle for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'published' => [ + 'description' => 'Set the publication status', + 'location' => 'json', + 'type' => 'boolean', + 'required' => false + ], + 'published_at' => [ + 'description' => 'Publication date for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'image' => [ + 'description' => 'Set the image (either through a base 64 attachment or URL)', + 'location' => 'json', + 'type' => 'array', + 'required' => false + ], + 'metafields' => [ + 'description' => 'Optional metafields to attach', + 'location' => 'json', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'CreateBlogArticle' => [ 'httpMethod' => 'POST', 'uri' => 'blogs/{blog_id}/articles.json', 'summary' => 'Create a new article', @@ -334,13 +403,13 @@ 'description' => 'HTML content for the article', 'location' => 'json', 'type' => 'string', - 'required' => true + 'required' => false ], 'summary_html' => [ 'description' => 'HTML content for the article\'s summary', 'location' => 'json', 'type' => 'string', - 'required' => true + 'required' => false ], 'handle' => [ 'description' => 'Handle for the article', @@ -376,6 +445,81 @@ ], 'UpdateArticle' => [ + 'httpMethod' => 'PUT', + 'uri' => 'articles/{id}.json', + 'summary' => 'Update an existing article', + 'data' => ['root_key' => 'article'], + 'parameters' => [ + 'id' => [ + 'description' => 'Article ID', + 'location' => 'uri', + 'type' => 'integer', + 'required' => true + ], + 'title' => [ + 'description' => 'Article title', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'author' => [ + 'description' => 'Author for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'tags' => [ + 'description' => 'Tags for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'body_html' => [ + 'description' => 'HTML content for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'summary_html' => [ + 'description' => 'HTML content for the article\'s summary', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'handle' => [ + 'description' => 'Handle for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'published' => [ + 'description' => 'Set the publication status', + 'location' => 'json', + 'type' => 'boolean', + 'required' => false + ], + 'published_at' => [ + 'description' => 'Publication date for the article', + 'location' => 'json', + 'type' => 'string', + 'required' => false + ], + 'image' => [ + 'description' => 'Set the image (either through a base 64 attachment or URL)', + 'location' => 'json', + 'type' => 'array', + 'required' => false + ], + 'metafields' => [ + 'description' => 'Optional metafields to attach', + 'location' => 'json', + 'type' => 'array', + 'required' => false + ] + ] + ], + + 'UpdateBlogArticle' => [ 'httpMethod' => 'PUT', 'uri' => 'blogs/{blog_id}/articles/{id}.json', 'summary' => 'Update an existing article', @@ -457,12 +601,26 @@ ], 'DeleteArticle' => [ + 'httpMethod' => 'DELETE', + 'uri' => 'articles/{id}.json', + 'summary' => 'Delete an existing article', + 'parameters' => [ + 'id' => [ + 'description' => 'Article ID', + 'location' => 'uri', + 'type' => 'integer', + 'required' => true + ] + ] + ], + + 'DeleteBlogArticle' => [ 'httpMethod' => 'DELETE', 'uri' => 'blogs/{blog_id}/articles/{id}.json', 'summary' => 'Delete an existing article', 'parameters' => [ 'id' => [ - 'description' => 'Page ID', + 'description' => 'Article ID', 'location' => 'uri', 'type' => 'integer', 'required' => true diff --git a/src/ShopifyClient.php b/src/ShopifyClient.php index 1102495..8974b29 100644 --- a/src/ShopifyClient.php +++ b/src/ShopifyClient.php @@ -23,7 +23,6 @@ use Guzzle\Service\Description\ServiceDescription; use Guzzle\Service\Resource\ResourceIterator; use Symfony\Component\EventDispatcher\EventDispatcher; -use ZfrShopify\Exception; use ZfrShopify\Iterator\ShopifyResourceIteratorFactory; /** @@ -43,8 +42,11 @@ * @method array getArticlesAuthors(array $args = []) {@command Shopify GetArticlesAuthors} * @method array getArticlesTags(array $args = []) {@command Shopify GetArticlesTags} * @method array createArticle(array $args = []) {@command Shopify CreateArticle} + * @method array createBlogArticle(array $args = []) {@command Shopify CreateBlogArticle} * @method array updateArticle(array $args = []) {@command Shopify UpdateArticle} + * @method array updateBlogArticle(array $args = []) {@command Shopify UpdateBlogArticle} * @method array deleteArticle(array $args = []) {@command Shopify DeleteArticle} + * @method array deleteBlogArticle(array $args = []) {@command Shopify DeleteBlogArticle} * * ASSET RELATED METHODS: *