AdGroup   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 9
c 1
b 0
f 0
dl 0
loc 30
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Promopult\TikTokMarketingApi\Service;
6
7
/**
8
 * @psalm-suppress UnusedClass
9
 */
10
final class AdGroup extends \Promopult\TikTokMarketingApi\AbstractService
11
{
12
    /**
13
     * @param int $advertiserId         Advertiser ID
14
     * @param array|null $fields        Fields to be returned. When not specified, all fields are returned by default.
15
     * @param array|null $filtering     Filter conditions. Set these conditions according to your requirements.
16
     *                                  If not set, all ad groups under the advertiser will be returned.
17
     * @param int|null $page            Current page number. Default value is 1. Range of values: ≥ 1
18
     * @param int|null $pageSize        Page size.Default value is: 10. Range of values: 1-1000
19
     * @return array
20
     * @throws \Throwable
21
     *
22
     * @see https://ads.tiktok.com/marketing_api/docs?id=100529
23
     */
24
    public function get(
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.3/adgroup/get/',
34
            [
35
                'advertiser_id' => $advertiserId,
36
                'fields' => $fields,
37
                'filtering' => $filtering,
38
                'page' => $page,
39
                'page_size' => $pageSize
40
            ]
41
        );
42
    }
43
}
44