|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace CloudyCity\UCMarketingSDK\Creative; |
|
4
|
|
|
|
|
5
|
|
|
use CloudyCity\UCMarketingSDK\Kernel\BaseClient; |
|
6
|
|
|
|
|
7
|
|
|
class Client extends BaseClient |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* 创建推广创意. |
|
11
|
|
|
* |
|
12
|
|
|
* @param $adGroupId |
|
13
|
|
|
* |
|
14
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\ApiException |
|
15
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\InvalidArgumentException |
|
16
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
17
|
|
|
* |
|
18
|
|
|
* @return array|\Doctrine\Common\Collections\ArrayCollection|object|\Psr\Http\Message\ResponseInterface|string |
|
19
|
|
|
*/ |
|
20
|
|
|
public function getTemplates(array $adGroupId) |
|
21
|
|
|
{ |
|
22
|
|
|
$params = [ |
|
23
|
|
|
'adgroupId' => $adGroupId, |
|
24
|
|
|
]; |
|
25
|
|
|
|
|
26
|
|
|
return $this->httpPostJson('creative/getCreativeTemplate', $params); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* 创建推广创意. |
|
31
|
|
|
* |
|
32
|
|
|
* @param $params |
|
33
|
|
|
* |
|
34
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\ApiException |
|
35
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\InvalidArgumentException |
|
36
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
37
|
|
|
* |
|
38
|
|
|
* @return array|\Doctrine\Common\Collections\ArrayCollection|object|\Psr\Http\Message\ResponseInterface|string |
|
39
|
|
|
*/ |
|
40
|
|
|
public function add(array $params) |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->httpPostJson('creative/add', $params); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* 更新推广创意. |
|
47
|
|
|
* |
|
48
|
|
|
* @param $params |
|
49
|
|
|
* |
|
50
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\ApiException |
|
51
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\InvalidArgumentException |
|
52
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
53
|
|
|
* |
|
54
|
|
|
* @return array|\Doctrine\Common\Collections\ArrayCollection|object|\Psr\Http\Message\ResponseInterface|string |
|
55
|
|
|
*/ |
|
56
|
|
|
public function update(array $params) |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->httpPostJson('creative/update', $params); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* 更新推广创意的状态. |
|
63
|
|
|
* |
|
64
|
|
|
* @param $creativeIds |
|
65
|
|
|
* @param bool $paused |
|
66
|
|
|
* |
|
67
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\ApiException |
|
68
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\InvalidArgumentException |
|
69
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
70
|
|
|
* |
|
71
|
|
|
* @return array|\Doctrine\Common\Collections\ArrayCollection|object|\Psr\Http\Message\ResponseInterface|string |
|
72
|
|
|
*/ |
|
73
|
|
|
public function updatePaused(array $creativeIds, $paused) |
|
74
|
|
|
{ |
|
75
|
|
|
$params = [ |
|
76
|
|
|
'adGroupIds' => $creativeIds, |
|
77
|
|
|
'paused' => $paused, |
|
78
|
|
|
]; |
|
79
|
|
|
|
|
80
|
|
|
return $this->httpPostJson('creative/paused/update', $params); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* 删除推广创意. |
|
85
|
|
|
* |
|
86
|
|
|
* @param $creativeIds |
|
87
|
|
|
* |
|
88
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\ApiException |
|
89
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\InvalidArgumentException |
|
90
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
91
|
|
|
* |
|
92
|
|
|
* @return array|\Doctrine\Common\Collections\ArrayCollection|object|\Psr\Http\Message\ResponseInterface|string |
|
93
|
|
|
*/ |
|
94
|
|
|
public function delete(array $creativeIds) |
|
95
|
|
|
{ |
|
96
|
|
|
$params = [ |
|
97
|
|
|
'creativeIds' => $creativeIds, |
|
98
|
|
|
]; |
|
99
|
|
|
|
|
100
|
|
|
return $this->httpPostJson('creative/delete', $params); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* 根据推广计划id获取推广创意. |
|
105
|
|
|
* |
|
106
|
|
|
* @param $campaignIds |
|
107
|
|
|
* |
|
108
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\ApiException |
|
109
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\InvalidArgumentException |
|
110
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
111
|
|
|
* |
|
112
|
|
|
* @return array|\Doctrine\Common\Collections\ArrayCollection|object|\Psr\Http\Message\ResponseInterface|string |
|
113
|
|
|
*/ |
|
114
|
|
|
public function getByCampaignIds(array $campaignIds) |
|
115
|
|
|
{ |
|
116
|
|
|
$params = [ |
|
117
|
|
|
'campaignIds' => $campaignIds, |
|
118
|
|
|
]; |
|
119
|
|
|
|
|
120
|
|
|
return $this->httpPostJson('creative/getCreativeByCampaignId', $params); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* 根据推广计划id获取推广创意id. |
|
125
|
|
|
* |
|
126
|
|
|
* @param $campaignIds |
|
127
|
|
|
* |
|
128
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\ApiException |
|
129
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\InvalidArgumentException |
|
130
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
131
|
|
|
* |
|
132
|
|
|
* @return array|\Doctrine\Common\Collections\ArrayCollection|object|\Psr\Http\Message\ResponseInterface|string |
|
133
|
|
|
*/ |
|
134
|
|
|
public function getIdsByCampaignIds(array $campaignIds) |
|
135
|
|
|
{ |
|
136
|
|
|
$params = [ |
|
137
|
|
|
'campaignIds' => $campaignIds, |
|
138
|
|
|
]; |
|
139
|
|
|
|
|
140
|
|
|
return $this->httpPostJson('creative/getCreativeIdByCampaignId', $params); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* 根据推广创意id获取推广创意. |
|
145
|
|
|
* |
|
146
|
|
|
* @param $creativeIds |
|
147
|
|
|
* |
|
148
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\ApiException |
|
149
|
|
|
* @throws \CloudyCity\UCMarketingSDK\Kernel\Exceptions\InvalidArgumentException |
|
150
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
151
|
|
|
* |
|
152
|
|
|
* @return array|\Doctrine\Common\Collections\ArrayCollection|object|\Psr\Http\Message\ResponseInterface|string |
|
153
|
|
|
*/ |
|
154
|
|
|
public function getByIds(array $creativeIds) |
|
155
|
|
|
{ |
|
156
|
|
|
$params = [ |
|
157
|
|
|
'creativeIds' => $creativeIds, |
|
158
|
|
|
]; |
|
159
|
|
|
|
|
160
|
|
|
return $this->httpPostJson('creative/getCreativeByCreativeId', $params); |
|
161
|
|
|
} |
|
162
|
|
|
} |
|
163
|
|
|
|