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