WebhooksEndpoint::attempts()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DigitalCz\DigiSign\Endpoint;
6
7
use DigitalCz\DigiSign\DigiSign;
8
use DigitalCz\DigiSign\Endpoint\Traits\CRUDEndpointTrait;
9
use DigitalCz\DigiSign\Resource\ResourceInterface;
10
use DigitalCz\DigiSign\Resource\Webhook;
11
12
/**
13
 * @extends ResourceEndpoint<Webhook>
14
 * @method Webhook get(string $id)
15
 * @method Webhook create(array $body)
16
 * @method Webhook update(string $id, array $body)
17
 */
18
final class WebhooksEndpoint extends ResourceEndpoint
19
{
20
    /** @use CRUDEndpointTrait<Webhook> */
21
    use CRUDEndpointTrait;
22
23
    public function __construct(DigiSign $parent)
24
    {
25
        parent::__construct($parent, '/api/webhooks', Webhook::class);
26
    }
27
28
    /**
29
     * @param Webhook|string $webhook
30
     */
31
    public function attempts($webhook): WebhookAttemptsEndpoint
32
    {
33
        return new WebhookAttemptsEndpoint($this, $webhook);
34
    }
35
36
    public function test(string $id): ResourceInterface
37
    {
38
        return $this->createResource($this->postRequest('/{id}/test', ['id' => $id]));
39
    }
40
}
41