Tools   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 24
c 2
b 0
f 0
dl 0
loc 100
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A osVersion() 0 8 1
A carrier() 0 7 1
A interestCategory() 0 12 1
A actionCategory() 0 7 1
A language() 0 7 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 Tools extends \Promopult\TikTokMarketingApi\AbstractService
11
{
12
    /**
13
     * Getting Language enumeration values.
14
     *
15
     * @param int $advertiserId     # Advertiser ID
16
     *
17
     * @return array
18
     *
19
     * @throws \Throwable
20
     */
21
    public function language(int $advertiserId): array
22
    {
23
        return $this->requestApi(
24
            'GET',
25
            '/open_api/v1.3/tool/language/',
26
            [
27
                'advertiser_id' => $advertiserId
28
            ]
29
        );
30
    }
31
32
    /**
33
     * Getting Behavior Category enumeration values.
34
     *
35
     * @param int $advertiserId     # Advertiser ID
36
     *
37
     * @return array
38
     *
39
     * @throws \Throwable
40
     */
41
    public function actionCategory(int $advertiserId): array
42
    {
43
        return $this->requestApi(
44
            'GET',
45
            '/open_api/v1.3/tool/action_category/',
46
            [
47
                'advertiser_id' => $advertiserId
48
            ]
49
        );
50
    }
51
52
    /**
53
     * Geting Carriers enumeration values.
54
     *
55
     * @param int $advertiserId     # Advertiser ID
56
     * @return array
57
     * @throws \Throwable
58
     */
59
    public function carrier(int $advertiserId): array
60
    {
61
        return $this->requestApi(
62
            'GET',
63
            '/open_api/v1.3/tool/carrier/',
64
            [
65
                'advertiser_id' => $advertiserId
66
            ]
67
        );
68
    }
69
70
    /**
71
     * Getting OS Version enumeration values.
72
     *
73
     * @param int $advertiserId     # Advertiser ID
74
     * @param string $osType        # OStype, optional values include: ANDROID,IOS
75
     * @return array
76
     * @throws \Throwable
77
     */
78
    public function osVersion(int $advertiserId, string $osType): array
79
    {
80
        return $this->requestApi(
81
            'GET',
82
            '/open_api/v1.3/tool/os_version/',
83
            [
84
                'advertiser_id' => $advertiserId,
85
                'os_type' => $osType
86
            ]
87
        );
88
    }
89
90
    /**
91
     * @param int $advertiserId     # Advertiser ID
92
     * @param ?int $version          # Version of interest category,optional values include:
93
     *                                1 (interest_category), 2 (interest_category_v2). Default: 2.
94
     * @param ?array $placement
95
     * @return array
96
     * @throws \Throwable
97
     */
98
    public function interestCategory(
99
        int $advertiserId,
100
        ?int $version = null,
101
        ?array $placement = null
102
    ): array {
103
        return $this->requestApi(
104
            'GET',
105
            '/open_api/v1.3/tool/interest_category/',
106
            [
107
                'advertiser_id' => $advertiserId,
108
                'version' => $version,
109
                'placement' => $placement
110
            ]
111
        );
112
    }
113
}
114