|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Signifly\Shopify\REST\Actions; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\Collection; |
|
6
|
|
|
use Signifly\Shopify\REST\Cursor; |
|
7
|
|
|
use Signifly\Shopify\REST\Resources\ApiResource; |
|
8
|
|
|
use Signifly\Shopify\REST\Resources\ArticleResource; |
|
9
|
|
|
use Signifly\Shopify\REST\Resources\BlogResource; |
|
10
|
|
|
use Signifly\Shopify\REST\Resources\PageResource; |
|
11
|
|
|
use Signifly\Shopify\Shopify; |
|
12
|
|
|
|
|
13
|
|
|
/** @mixin Shopify */ |
|
14
|
|
|
trait ManagesOnlineStore |
|
15
|
|
|
{ |
|
16
|
|
|
public function createRedirect(string $path, string $target): ApiResource |
|
17
|
|
|
{ |
|
18
|
|
|
return $this->createResource('redirects', [ |
|
|
|
|
|
|
19
|
|
|
'path' => $path, |
|
20
|
|
|
'target' => $target, |
|
21
|
|
|
]); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function getRedirectsCount(array $params = []): int |
|
25
|
|
|
{ |
|
26
|
|
|
return $this->getResourceCount('redirects', $params); |
|
|
|
|
|
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function paginateRedirects(array $params = []): Cursor |
|
30
|
|
|
{ |
|
31
|
|
|
return $this->cursor($this->getRedirects($params)); |
|
|
|
|
|
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function getRedirects(array $params = []): Collection |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->getResources('redirects', $params); |
|
|
|
|
|
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function getRedirect($redirectId): ApiResource |
|
40
|
|
|
{ |
|
41
|
|
|
return $this->getResource('redirects', $redirectId); |
|
|
|
|
|
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function updateRedirect($redirectId, $data): ApiResource |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->updateResource('redirects', $redirectId, $data); |
|
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function deleteRedirect($redirectId): void |
|
50
|
|
|
{ |
|
51
|
|
|
$this->deleteResource('redirects', $redirectId); |
|
|
|
|
|
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function createBlog(array $data): BlogResource |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->createResource('blogs', $data); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function getBlogsCount(array $params = []): int |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->getResourceCount('blogs', $params); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function paginateBlogs(array $params = []): Cursor |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->cursor($this->getBlogs($params)); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getBlogs(array $params = []): Collection |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->getResources('blogs', $params); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getBlog($blogId): BlogResource |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->getResource('blogs', $blogId); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function updateBlog($blogId, $data): BlogResource |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->updateResource('blogs', $blogId, $data); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function deleteBlog($blogId): void |
|
85
|
|
|
{ |
|
86
|
|
|
$this->deleteResource('blogs', $blogId); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function createPage(array $data): PageResource |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->createResource('pages', $data); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
public function getPagesCount(array $params = []): int |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->getResourceCount('pages', $params); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
public function paginatePages(array $params = []): Cursor |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->cursor($this->getPages($params)); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function getPages(array $params = []): Collection |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->getResources('pages', $params); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
public function getPage($pageId): PageResource |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->getResource('pages', $pageId); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function updatePage($pageId, $data): PageResource |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->updateResource('pages', $pageId, $data); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function deletePage($pageId): void |
|
120
|
|
|
{ |
|
121
|
|
|
$this->deleteResource('pages', $pageId); |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
public function createArticle(array $data): ArticleResource |
|
125
|
|
|
{ |
|
126
|
|
|
return $this->createResource('articles', $data); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
public function getArticlesCount(array $params = []): int |
|
130
|
|
|
{ |
|
131
|
|
|
return $this->getResourceCount('articles', $params); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function paginateArticles(array $params = []): Cursor |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->cursor($this->getArticles($params)); |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
public function getArticles(array $params = []): Collection |
|
140
|
|
|
{ |
|
141
|
|
|
return $this->getResources('articles', $params); |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
public function getArticleAuthors(): array |
|
145
|
|
|
{ |
|
146
|
|
|
$response = $this->get('articles/authors.json'); |
|
|
|
|
|
|
147
|
|
|
|
|
148
|
|
|
return $response->json('authors'); |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
public function getArticleTags(array $params = []): array |
|
152
|
|
|
{ |
|
153
|
|
|
$response = $this->get('articles/tags.json', $params); |
|
154
|
|
|
|
|
155
|
|
|
return $response->json('tags'); |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
public function getArticle($articleId): ArticleResource |
|
159
|
|
|
{ |
|
160
|
|
|
return $this->getResource('articles', $articleId); |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
public function updateArticle($articleId, $data): ArticleResource |
|
164
|
|
|
{ |
|
165
|
|
|
return $this->updateResource('articles', $articleId, $data); |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
public function deleteArticle($articleId): void |
|
169
|
|
|
{ |
|
170
|
|
|
$this->deleteResource('articles', $articleId); |
|
171
|
|
|
} |
|
172
|
|
|
} |
|
173
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.