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\AssetResource; |
10
|
|
|
use Signifly\Shopify\REST\Resources\BlogResource; |
11
|
|
|
use Signifly\Shopify\REST\Resources\PageResource; |
12
|
|
|
use Signifly\Shopify\Shopify; |
13
|
|
|
|
14
|
|
|
/** @mixin Shopify */ |
15
|
|
|
trait ManagesOnlineStore |
16
|
|
|
{ |
17
|
|
|
public function createRedirect(string $path, string $target): ApiResource |
18
|
|
|
{ |
19
|
|
|
return $this->createResource('redirects', [ |
|
|
|
|
20
|
|
|
'path' => $path, |
21
|
|
|
'target' => $target, |
22
|
|
|
]); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function getRedirectsCount(array $params = []): int |
26
|
|
|
{ |
27
|
|
|
return $this->getResourceCount('redirects', $params); |
|
|
|
|
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function paginateRedirects(array $params = []): Cursor |
31
|
|
|
{ |
32
|
|
|
return $this->cursor($this->getRedirects($params)); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function getRedirects(array $params = []): Collection |
36
|
|
|
{ |
37
|
|
|
return $this->getResources('redirects', $params); |
|
|
|
|
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function getRedirect($redirectId): ApiResource |
41
|
|
|
{ |
42
|
|
|
return $this->getResource('redirects', $redirectId); |
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function updateRedirect($redirectId, $data): ApiResource |
46
|
|
|
{ |
47
|
|
|
return $this->updateResource('redirects', $redirectId, $data); |
|
|
|
|
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function deleteRedirect($redirectId): void |
51
|
|
|
{ |
52
|
|
|
$this->deleteResource('redirects', $redirectId); |
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function createBlog(array $data): BlogResource |
56
|
|
|
{ |
57
|
|
|
return $this->createResource('blogs', $data); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getBlogsCount(array $params = []): int |
61
|
|
|
{ |
62
|
|
|
return $this->getResourceCount('blogs', $params); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function paginateBlogs(array $params = []): Cursor |
66
|
|
|
{ |
67
|
|
|
return $this->cursor($this->getBlogs($params)); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function getBlogs(array $params = []): Collection |
71
|
|
|
{ |
72
|
|
|
return $this->getResources('blogs', $params); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getBlog($blogId): BlogResource |
76
|
|
|
{ |
77
|
|
|
return $this->getResource('blogs', $blogId); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function updateBlog($blogId, $data): BlogResource |
81
|
|
|
{ |
82
|
|
|
return $this->updateResource('blogs', $blogId, $data); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function deleteBlog($blogId): void |
86
|
|
|
{ |
87
|
|
|
$this->deleteResource('blogs', $blogId); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function createPage(array $data): PageResource |
91
|
|
|
{ |
92
|
|
|
return $this->createResource('pages', $data); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function getPagesCount(array $params = []): int |
96
|
|
|
{ |
97
|
|
|
return $this->getResourceCount('pages', $params); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function paginatePages(array $params = []): Cursor |
101
|
|
|
{ |
102
|
|
|
return $this->cursor($this->getPages($params)); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function getPages(array $params = []): Collection |
106
|
|
|
{ |
107
|
|
|
return $this->getResources('pages', $params); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function getPage($pageId): PageResource |
111
|
|
|
{ |
112
|
|
|
return $this->getResource('pages', $pageId); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function updatePage($pageId, $data): PageResource |
116
|
|
|
{ |
117
|
|
|
return $this->updateResource('pages', $pageId, $data); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function deletePage($pageId): void |
121
|
|
|
{ |
122
|
|
|
$this->deleteResource('pages', $pageId); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function createArticle(array $data): ArticleResource |
126
|
|
|
{ |
127
|
|
|
return $this->createResource('articles', $data); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function getArticlesCount(array $params = []): int |
131
|
|
|
{ |
132
|
|
|
return $this->getResourceCount('articles', $params); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function paginateArticles(array $params = []): Cursor |
136
|
|
|
{ |
137
|
|
|
return $this->cursor($this->getArticles($params)); |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
public function getArticles(array $params = []): Collection |
141
|
|
|
{ |
142
|
|
|
return $this->getResources('articles', $params); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function getArticleAuthors(): array |
146
|
|
|
{ |
147
|
|
|
$response = $this->get('articles/authors.json'); |
|
|
|
|
148
|
|
|
|
149
|
|
|
return $response->json('authors'); |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function getArticleTags(array $params = []): array |
153
|
|
|
{ |
154
|
|
|
$response = $this->get('articles/tags.json', $params); |
155
|
|
|
|
156
|
|
|
return $response->json('tags'); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function getArticle($articleId): ArticleResource |
160
|
|
|
{ |
161
|
|
|
return $this->getResource('articles', $articleId); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
public function updateArticle($articleId, $data): ArticleResource |
165
|
|
|
{ |
166
|
|
|
return $this->updateResource('articles', $articleId, $data); |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public function deleteArticle($articleId): void |
170
|
|
|
{ |
171
|
|
|
$this->deleteResource('articles', $articleId); |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
public function getAssets($themeId, array $params = []): Collection |
175
|
|
|
{ |
176
|
|
|
return $this->getResources('assets', $params, ['themes', $themeId]); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
public function getAsset($themeId, $assetKey): AssetResource |
180
|
|
|
{ |
181
|
|
|
$response = $this->get('themes/' . $themeId . '/assets.json?asset[key]=' . $assetKey); |
182
|
|
|
|
183
|
|
|
return new AssetResource($response['asset'], $this); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
public function updateAsset($themeId, array $data) |
187
|
|
|
{ |
188
|
|
|
$response = $this->put('themes/' . $themeId . '/assets.json', $data); |
|
|
|
|
189
|
|
|
|
190
|
|
|
return new AssetResource($response['asset'], $this); |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public function deleteAsset($themeId, $assetKey) |
194
|
|
|
{ |
195
|
|
|
$this->delete('themes/' . $themeId . '/assets.json?asset[key]=' . $assetKey); |
|
|
|
|
196
|
|
|
} |
197
|
|
|
} |
198
|
|
|
|
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.