|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ShopifyClient\Resource; |
|
4
|
|
|
|
|
5
|
|
|
use ShopifyClient\Action\Action; |
|
6
|
|
|
use ShopifyClient\Request; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* https://help.shopify.com/api/reference/article |
|
10
|
|
|
* |
|
11
|
|
|
* @method create(float $parentId, array $parameters = []) |
|
12
|
|
|
* @method get(float $parentId, float $childId) |
|
13
|
|
|
* @method all(float $parentId, array $parameters = []) |
|
14
|
|
|
* @method count(float $parentId) |
|
15
|
|
|
* @method update(float $parentId, float $childId, array $parameters = []) |
|
16
|
|
|
* @method tags(float $parentId, array $parameters = []) |
|
17
|
|
|
* @method authors |
|
18
|
|
|
* @method delete(float $parentId, float $childId) |
|
19
|
|
|
* |
|
20
|
|
|
* @property ArticleMetaField $metafields |
|
21
|
|
|
* @property CustomerAddress $addresses |
|
22
|
|
|
*/ |
|
23
|
|
|
class Article extends AbstractResource implements Resource |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $childResources = [ |
|
29
|
|
|
'metafields' => ArticleMetaField::class, |
|
30
|
|
|
]; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Article constructor. |
|
34
|
|
|
* @param Request $request |
|
35
|
|
|
*/ |
|
36
|
5 |
|
public function __construct(Request $request) |
|
37
|
|
|
{ |
|
38
|
5 |
|
parent::__construct($request); |
|
39
|
|
|
|
|
40
|
5 |
|
$this->actions->add('create', new Action(Request::METHOD_POST, 'blogs/%s/articles.json', 'article', 'article')); |
|
41
|
5 |
|
$this->actions->add('get', new Action(Request::METHOD_GET, 'blogs/%s/articles/%s.json', 'article', 'article')); |
|
42
|
5 |
|
$this->actions->add('all', new Action(Request::METHOD_GET, 'blogs/%s/articles.json', 'articles', 'articles')); |
|
43
|
5 |
|
$this->actions->add('count', new Action(Request::METHOD_GET, 'blogs/%s/articles/count.json', 'count', 'count')); |
|
44
|
5 |
|
$this->actions->add('update', new Action(Request::METHOD_PUT, 'blogs/%s/articles/%s.json', 'article', 'article')); |
|
45
|
5 |
|
$this->actions->add('tags', new Action(Request::METHOD_GET, 'blogs/%s/articles/tags.json', 'tags', 'tags')); |
|
46
|
5 |
|
$this->actions->add('authors', new Action(Request::METHOD_GET, 'articles/authors.json', 'authors', 'authors')); |
|
47
|
5 |
|
$this->actions->add('delete', new Action(Request::METHOD_DELETE, 'blogs/%s/articles/%s.json')); |
|
48
|
5 |
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|