Skip to content

Commit

Permalink
Merge pull request #21 from zf-fr/fix-article
Browse files Browse the repository at this point in the history
Add endpoints
  • Loading branch information
bakura10 authored Sep 22, 2016
2 parents a1b29aa + feba8dc commit daf3a10
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**

Expand Down
164 changes: 161 additions & 3 deletions src/ServiceDescription/Shopify-v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/ShopifyClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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:
*
Expand Down

0 comments on commit daf3a10

Please sign in to comment.