Passed
Push — 1.x ( b10dca...e5406b )
by Pavel
02:16
created

EnvelopeTemplatesEndpoint::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
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\Envelope;
10
use DigitalCz\DigiSign\Resource\EnvelopeTemplate;
11
12
/**
13
 * @extends ResourceEndpoint<EnvelopeTemplate>
14
 * @method EnvelopeTemplate get(string $id)
15
 * @method EnvelopeTemplate create(array $body)
16
 * @method EnvelopeTemplate update(string $id, array $body)
17
 */
18
final class EnvelopeTemplatesEndpoint extends ResourceEndpoint
19
{
20
    /** @use CRUDEndpointTrait<EnvelopeTemplate> */
21
    use CRUDEndpointTrait;
22
23
    public function __construct(DigiSign $parent)
24
    {
25
        parent::__construct($parent, '/api/envelope-templates', EnvelopeTemplate::class);
26
    }
27
28
    /**
29
     * @param EnvelopeTemplate|string $template
30
     */
31
    public function use($template): Envelope
32
    {
33
        return $this->createResource($this->postRequest('/{id}/use', ['id' => $template]), Envelope::class);
34
    }
35
36
    /**
37
     * @param EnvelopeTemplate|string $template
38
     */
39
    public function documents($template): EnvelopeTemplateDocumentsEndpoint
40
    {
41
        return new EnvelopeTemplateDocumentsEndpoint($this, $template);
42
    }
43
44
    /**
45
     * @param EnvelopeTemplate|string $template
46
     */
47
    public function recipients($template): EnvelopeTemplateRecipientsEndpoint
48
    {
49
        return new EnvelopeTemplateRecipientsEndpoint($this, $template);
50
    }
51
52
    /**
53
     * @param EnvelopeTemplate|string $template
54
     */
55
    public function notifications($template): EnvelopeTemplateNotificationsEndpoint
56
    {
57
        return new EnvelopeTemplateNotificationsEndpoint($this, $template);
58
    }
59
60
    /**
61
     * @param EnvelopeTemplate|string $template
62
     */
63
    public function tags($template): EnvelopeTemplateTagsEndpoint
64
    {
65
        return new EnvelopeTemplateTagsEndpoint($this, $template);
66
    }
67
}
68