WebhookEndpoint::list()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Ipag\Sdk\Endpoint;
4
5
use Ipag\Sdk\Core\Endpoint;
6
use Ipag\Sdk\Http\Response;
7
use Ipag\Sdk\Model\Webhook;
8
9
10
/**
11
 * WebhookEndpoint class
12
 *
13
 * Classe responsável pelo controle dos endpoints do recurso Webhook.
14
 *
15
 */
16
class WebhookEndpoint extends Endpoint
17
{
18
19
    protected string $location = '/service/resources/webhooks';
20
21
    /**
22
     * Endpoint para criar um recurso `webhook`
23
     *
24
     * @param Webhook $webhook
25
     * @return Response
26
     */
27
    public function create(Webhook $webhook): Response
28
    {
29
        return $this->_POST($webhook->jsonSerialize());
30
    }
31
32
    /**
33
     * Endpoint para obter um recurso `webhook`
34
     *
35
     * @param integer $id
36
     * @return Response
37
     *
38
     * @codeCoverageIgnore
39
     */
40
    public function get(int $id): Response
41
    {
42
        return $this->_GET(['id' => $id]);
43
    }
44
45
    /**
46
     * Endpoint para listar recursos `webhook`
47
     *
48
     * @param array|null $filters
49
     * @return Response
50
     *
51
     * @codeCoverageIgnore
52
     */
53
    public function list(?array $filters = []): Response
54
    {
55
        return $this->_GET($filters ?? []);
56
    }
57
58
    /**
59
     * Endpoint para deletar um recurso `webhook`
60
     *
61
     * @param integer $id
62
     * @return Response
63
     *
64
     * @codeCoverageIgnore
65
     */
66
    public function delete(int $id): Response
67
    {
68
        return $this->_DELETE(['id' => $id]);
69
    }
70
71
}