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 clone($template): EnvelopeTemplate |
32
|
|
|
{ |
33
|
|
|
return $this->createResource($this->postRequest('/{id}/clone', ['id' => $template]), EnvelopeTemplate::class); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param EnvelopeTemplate|string $template |
38
|
|
|
*/ |
39
|
|
|
public function use($template): Envelope |
40
|
|
|
{ |
41
|
|
|
return $this->createResource($this->postRequest('/{id}/use', ['id' => $template]), Envelope::class); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param EnvelopeTemplate|string $template |
46
|
|
|
*/ |
47
|
|
|
public function documents($template): EnvelopeTemplateDocumentsEndpoint |
48
|
|
|
{ |
49
|
|
|
return new EnvelopeTemplateDocumentsEndpoint($this, $template); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param EnvelopeTemplate|string $template |
54
|
|
|
*/ |
55
|
|
|
public function recipients($template): EnvelopeTemplateRecipientsEndpoint |
56
|
|
|
{ |
57
|
|
|
return new EnvelopeTemplateRecipientsEndpoint($this, $template); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param EnvelopeTemplate|string $template |
62
|
|
|
*/ |
63
|
|
|
public function notifications($template): EnvelopeTemplateNotificationsEndpoint |
64
|
|
|
{ |
65
|
|
|
return new EnvelopeTemplateNotificationsEndpoint($this, $template); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param EnvelopeTemplate|string $template |
70
|
|
|
*/ |
71
|
|
|
public function tags($template): EnvelopeTemplateTagsEndpoint |
72
|
|
|
{ |
73
|
|
|
return new EnvelopeTemplateTagsEndpoint($this, $template); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param EnvelopeTemplate|string $template |
78
|
|
|
*/ |
79
|
|
|
public function labels($template): EnvelopeTemplateLabelsEndpoint |
80
|
|
|
{ |
81
|
|
|
return new EnvelopeTemplateLabelsEndpoint($this, $template); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|