Total Complexity | 5 |
Total Lines | 94 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
10 | class Webhooks extends Client |
||
11 | { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $namespace = __CLASS__; |
||
16 | |||
17 | /** |
||
18 | * @param int $webhook_id The webhook id |
||
19 | * |
||
20 | * @return $this |
||
21 | */ |
||
22 | public function __invoke(int $webhook_id): self |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * List all webhooks |
||
31 | * Returns a list of your promotions. The promotions are returned sorted by creation date, with the most recent promotion appearing first. |
||
32 | * |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function all(): self |
||
36 | { |
||
37 | // Set HTTP params |
||
38 | $this->type = 'get'; |
||
39 | $this->endpoint = '/webhooks'; |
||
40 | $this->response = WebhookList::class; |
||
41 | |||
42 | return $this; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Create a webhook |
||
47 | * |
||
48 | * @param Webhook $webhook |
||
49 | * |
||
50 | * @return $this |
||
51 | */ |
||
52 | public function create(Webhook $webhook): self |
||
53 | { |
||
54 | $webhook->setRequired([ |
||
55 | 'endpoint', |
||
56 | 'events', |
||
57 | ]); |
||
58 | |||
59 | // Set HTTP params |
||
60 | $this->type = 'post'; |
||
61 | $this->endpoint = '/webhooks'; |
||
62 | $this->params = $webhook; |
||
63 | $this->response = Webhook::class; |
||
64 | |||
65 | return $this; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Update a webhook |
||
70 | * |
||
71 | * @param Webhook $webhook |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | public function update(Webhook $webhook): self |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Delete a webhook |
||
93 | * |
||
94 | * @return $this |
||
95 | */ |
||
96 | public function delete(): self |
||
104 | } |
||
105 | } |
||
106 |