DownloadPreviewTrait::executeRequest()
last analyzed

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the zibios/wrike-php-library package.
7
 *
8
 * (c) Zbigniew Ślązak
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zibios\WrikePhpLibrary\Resource\Traits;
15
16
use Zibios\WrikePhpLibrary\Enum\Api\RequestMethodEnum;
17
use Zibios\WrikePhpLibrary\Enum\Api\ResourceMethodEnum;
18
19
/**
20
 * DownloadPreview Trait.
21
 */
22
trait DownloadPreviewTrait
23
{
24
    /**
25
     * @param string     $id
26
     * @param array|null $params
27
     *
28
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
29
     * @throws \LogicException
30
     * @throws \InvalidArgumentException
31
     * @throws \Throwable
32
     *
33
     * @return mixed
34
     */
35 1
    public function downloadPreview(string $id, array $params = [])
36
    {
37 1
        return $this->executeRequest(
38 1
            RequestMethodEnum::GET,
39 1
            ResourceMethodEnum::DOWNLOAD_PREVIEW,
40 1
            $params,
41 1
            $id
42
        );
43
    }
44
45
    /**
46
     * @param string       $requestMethod
47
     * @param string       $requestScope
48
     * @param array        $params
49
     * @param string|array $id
50
     *
51
     * @throws \Zibios\WrikePhpLibrary\Exception\Api\ApiException
52
     * @throws \LogicException
53
     * @throws \InvalidArgumentException
54
     * @throws \Throwable
55
     *
56
     * @return mixed
57
     */
58
    abstract protected function executeRequest(
59
        string $requestMethod,
60
        string $requestScope,
61
        array $params,
62
        $id
63
    );
64
}
65