Passed
Pull Request — 1.x (#58)
by
unknown
01:46
created

ContactsEndpoint::suggest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
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\DigiSign;
8
use DigitalCz\DigiSign\Resource\Collection;
9
use DigitalCz\DigiSign\Resource\Contact;
10
11
/**
12
 * @extends ResourceEndpoint<Contact>
13
 */
14
final class ContactsEndpoint extends ResourceEndpoint
15
{
16
    public function __construct(DigiSign $parent)
17
    {
18
        parent::__construct($parent, '/api/contacts', Contact::class);
19
    }
20
21
    /**
22
     * @return Collection<Contact>
23
     */
24
    public function suggest(string $search = '', int $limit = 30): Collection
25
    {
26
        $response = $this->getRequest('/suggest', ['query' => ['search' => $search, 'limit' => $limit]]);
27
28
        return $this->createCollectionResource($response, Contact::class);
29
    }
30
}
31