|
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\WebhookResource; |
|
9
|
|
|
use Signifly\Shopify\Shopify; |
|
10
|
|
|
|
|
11
|
|
|
/** @mixin Shopify */ |
|
12
|
|
|
trait ManagesEvents |
|
13
|
|
|
{ |
|
14
|
|
|
public function createEvent(array $data): ApiResource |
|
15
|
|
|
{ |
|
16
|
|
|
return $this->createResource('events', $data); |
|
|
|
|
|
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
public function getEventsCount(array $params = []): int |
|
20
|
|
|
{ |
|
21
|
|
|
return $this->getResourceCount('events', $params); |
|
|
|
|
|
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function paginateEvents(array $params = []): Cursor |
|
25
|
|
|
{ |
|
26
|
|
|
return $this->cursor($this->getEvents($params)); |
|
|
|
|
|
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function getEvents(array $params = []): Collection |
|
30
|
|
|
{ |
|
31
|
|
|
return $this->getResources('events', $params); |
|
|
|
|
|
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function createWebhook(array $data): WebhookResource |
|
35
|
|
|
{ |
|
36
|
|
|
return $this->createResource('webhooks', $data); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function getWebhooksCount(array $params = []): int |
|
40
|
|
|
{ |
|
41
|
|
|
return $this->getResourceCount('webhooks', $params); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function paginateWebhooks(array $params = []): Cursor |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->cursor($this->getWebhooks($params)); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getWebhooks(array $params = []): Collection |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->getResources('webhooks', $params); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getWebhook($webhookId): WebhookResource |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->getResource('webhooks', $webhookId); |
|
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function updateWebhook($webhookId, $data): WebhookResource |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->updateResource('webhooks', $webhookId, $data); |
|
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function deleteWebhook($webhookId): void |
|
65
|
|
|
{ |
|
66
|
|
|
$this->deleteResource('webhooks', $webhookId); |
|
|
|
|
|
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|