Passed
Push — master ( 4d7720...da1b67 )
by Dmitry
13:58
created

Ad::getAds()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 8
c 1
b 1
f 0
dl 0
loc 16
rs 10
cc 1
nc 1
nop 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Promopult\TikTokMarketingApi\Service;
6
7
use Throwable;
8
9
final class Ad extends \Promopult\TikTokMarketingApi\AbstractService
10
{
11
    /**
12
     * Get ads
13
     *
14
     * @param int $advertiserId
15
     * @param ?array $fields
16
     * @param ?array $filtering
17
     * @param ?int $page
18
     * @param ?int $pageSize
19
     *
20
     * @return array
21
     *
22
     * @throws Throwable
23
     */
24
    public function getAds(
25
        int $advertiserId,
26
        ?array $fields = null,
27
        ?array $filtering = null,
28
        ?int $page = null,
29
        ?int $pageSize = null
30
    ): array {
31
        return $this->requestApi(
32
            'GET',
33
            '/open_api/v1.2/ad/get/',
34
            [
35
                'advertiser_id' => $advertiserId,
36
                'fields' => $fields,
37
                'filtering' => $filtering,
38
                'page' => $page,
39
                'page_size' => $pageSize
40
            ]
41
        );
42
    }
43
}
44