Passed
Push — 1.x ( 990785...620e46 )
by Pavel
01:53
created

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DigitalCz\DigiSign\Endpoint;
6
7
use DigitalCz\DigiSign\Endpoint\Traits\GetEndpointTrait;
8
use DigitalCz\DigiSign\Endpoint\Traits\ListEndpointTrait;
9
use DigitalCz\DigiSign\Resource\EnvelopeRecipient;
10
use DigitalCz\DigiSign\Resource\EnvelopeRecipientAttachment;
11
use DigitalCz\DigiSign\Stream\FileResponse;
12
13
/**
14
 * @extends ResourceEndpoint<EnvelopeRecipientAttachment>
15
 * @method EnvelopeRecipientAttachment get(string $id)
16
 */
17
final class EnvelopeRecipientAttachmentsEndpoint extends ResourceEndpoint
18
{
19
    /** @use ListEndpointTrait<EnvelopeRecipientAttachment> */
20
    use ListEndpointTrait;
21
    use GetEndpointTrait;
22
23
    /**
24
     * @param EnvelopeRecipient|string $recipient
25
     */
26
    public function __construct(EnvelopeRecipientsEndpoint $parent, $recipient)
27
    {
28
        parent::__construct(
29
            $parent,
30
            '/{recipient}/attachments',
31
            EnvelopeRecipientAttachment::class,
32
            ['recipient' => $recipient]
33
        );
34
    }
35
36
    /**
37
     * @param EnvelopeRecipientAttachment|string $id
38
     * @param mixed[] $query
39
     */
40
    public function download($id, array $query = []): FileResponse
41
    {
42
        return $this->stream(self::METHOD_GET, '/{id}/download', ['id' => $id, 'query' => $query]);
43
    }
44
}
45