1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved. |
4
|
|
|
* |
5
|
|
|
* You are hereby granted a non-exclusive, worldwide, royalty-free license to |
6
|
|
|
* use, copy, modify, and distribute this software in source code or binary |
7
|
|
|
* form for use in connection with the web services and APIs provided by |
8
|
|
|
* Facebook. |
9
|
|
|
* |
10
|
|
|
* As with any software that integrates with the Facebook platform, your use |
11
|
|
|
* of this software is subject to the Facebook Developer Principles and |
12
|
|
|
* Policies [http://developers.facebook.com/policy/]. This copyright notice |
13
|
|
|
* shall be included in all copies or substantial portions of the software. |
14
|
|
|
* |
15
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
20
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21
|
|
|
* DEALINGS IN THE SOFTWARE. |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace FacebookAds\Object; |
26
|
|
|
|
27
|
|
|
use FacebookAds\ApiRequest; |
28
|
|
|
use FacebookAds\Cursor; |
29
|
|
|
use FacebookAds\Http\RequestInterface; |
30
|
|
|
use FacebookAds\TypeChecker; |
31
|
|
|
use FacebookAds\Object\Fields\AdSetFields; |
32
|
|
|
use FacebookAds\Object\Values\AdActivityCategoryValues; |
33
|
|
|
use FacebookAds\Object\Values\AdAsyncRequestStatusesValues; |
34
|
|
|
use FacebookAds\Object\Values\AdDatePresetValues; |
35
|
|
|
use FacebookAds\Object\Values\AdLabelExecutionOptionsValues; |
36
|
|
|
use FacebookAds\Object\Values\AdSetBillingEventValues; |
37
|
|
|
use FacebookAds\Object\Values\AdSetConfiguredStatusValues; |
38
|
|
|
use FacebookAds\Object\Values\AdSetDatePresetValues; |
39
|
|
|
use FacebookAds\Object\Values\AdSetEffectiveStatusValues; |
40
|
|
|
use FacebookAds\Object\Values\AdSetExecutionOptionsValues; |
41
|
|
|
use FacebookAds\Object\Values\AdSetOperatorValues; |
42
|
|
|
use FacebookAds\Object\Values\AdSetOptimizationGoalValues; |
43
|
|
|
use FacebookAds\Object\Values\AdSetStatusValues; |
44
|
|
|
use FacebookAds\Object\Values\AdsInsightsActionAttributionWindowsValues; |
45
|
|
|
use FacebookAds\Object\Values\AdsInsightsActionBreakdownsValues; |
46
|
|
|
use FacebookAds\Object\Values\AdsInsightsActionReportTimeValues; |
47
|
|
|
use FacebookAds\Object\Values\AdsInsightsBreakdownsValues; |
48
|
|
|
use FacebookAds\Object\Values\AdsInsightsDatePresetValues; |
49
|
|
|
use FacebookAds\Object\Values\AdsInsightsLevelValues; |
50
|
|
|
use FacebookAds\Object\Values\AdsInsightsSummaryActionBreakdownsValues; |
51
|
|
|
use FacebookAds\Object\Values\AdsInsightsSummaryValues; |
52
|
|
|
use FacebookAds\Object\Traits\AdLabelAwareCrudObjectTrait; |
53
|
|
|
use FacebookAds\Object\Traits\ObjectValidation; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* This class is auto-genereated. |
57
|
|
|
* |
58
|
|
|
* For any issues or feature requests related to this class, please let us know |
59
|
|
|
* on github and we'll fix in our codegen framework. We'll not be able to accept |
60
|
|
|
* pull request for this class. |
61
|
|
|
* |
62
|
|
|
*/ |
63
|
|
|
|
64
|
|
|
class AdSet extends AbstractArchivableCrudObject |
65
|
|
|
implements CanRedownloadInterface { |
66
|
|
|
|
67
|
|
|
use AdLabelAwareCrudObjectTrait; |
68
|
|
|
use ObjectValidation; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @deprecated getEndpoint function is deprecated |
72
|
|
|
*/ |
73
|
|
|
protected function getEndpoint() { |
74
|
|
|
return 'adsets'; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return AdSetFields |
79
|
|
|
*/ |
80
|
|
|
public static function getFieldsEnum() { |
81
|
|
|
return AdSetFields::getInstance(); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
protected static function getReferencedEnums() { |
85
|
|
|
$ref_enums = array(); |
86
|
|
|
$ref_enums['BillingEvent'] = AdSetBillingEventValues::getInstance()->getValues(); |
87
|
|
|
$ref_enums['ConfiguredStatus'] = AdSetConfiguredStatusValues::getInstance()->getValues(); |
88
|
|
|
$ref_enums['EffectiveStatus'] = AdSetEffectiveStatusValues::getInstance()->getValues(); |
89
|
|
|
$ref_enums['OptimizationGoal'] = AdSetOptimizationGoalValues::getInstance()->getValues(); |
90
|
|
|
$ref_enums['Status'] = AdSetStatusValues::getInstance()->getValues(); |
91
|
|
|
$ref_enums['DatePreset'] = AdSetDatePresetValues::getInstance()->getValues(); |
92
|
|
|
$ref_enums['ExecutionOptions'] = AdSetExecutionOptionsValues::getInstance()->getValues(); |
93
|
|
|
$ref_enums['Operator'] = AdSetOperatorValues::getInstance()->getValues(); |
94
|
|
|
return $ref_enums; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
public function getActivities(array $fields = array(), array $params = array(), $pending = false) { |
99
|
|
|
$this->assureId(); |
100
|
|
|
|
101
|
|
|
$param_types = array( |
102
|
|
|
'business_id' => 'string', |
103
|
|
|
'category' => 'category_enum', |
104
|
|
|
'since' => 'datetime', |
105
|
|
|
'uid' => 'int', |
106
|
|
|
'until' => 'datetime', |
107
|
|
|
); |
108
|
|
|
$enums = array( |
109
|
|
|
'category_enum' => AdActivityCategoryValues::getInstance()->getValues(), |
110
|
|
|
); |
111
|
|
|
|
112
|
|
|
$request = new ApiRequest( |
113
|
|
|
$this->api, |
114
|
|
|
$this->data['id'], |
115
|
|
|
RequestInterface::METHOD_GET, |
116
|
|
|
'/activities', |
117
|
|
|
new AdActivity(), |
118
|
|
|
'EDGE', |
119
|
|
|
AdActivity::getFieldsEnum()->getValues(), |
120
|
|
|
new TypeChecker($param_types, $enums) |
121
|
|
|
); |
122
|
|
|
$request->addParams($params); |
123
|
|
|
$request->addFields($fields); |
124
|
|
|
return $pending ? $request : $request->execute(); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function getAdCreatives(array $fields = array(), array $params = array(), $pending = false) { |
128
|
|
|
$this->assureId(); |
129
|
|
|
|
130
|
|
|
$param_types = array( |
131
|
|
|
); |
132
|
|
|
$enums = array( |
133
|
|
|
); |
134
|
|
|
|
135
|
|
|
$request = new ApiRequest( |
136
|
|
|
$this->api, |
137
|
|
|
$this->data['id'], |
138
|
|
|
RequestInterface::METHOD_GET, |
139
|
|
|
'/adcreatives', |
140
|
|
|
new AdCreative(), |
141
|
|
|
'EDGE', |
142
|
|
|
AdCreative::getFieldsEnum()->getValues(), |
143
|
|
|
new TypeChecker($param_types, $enums) |
144
|
|
|
); |
145
|
|
|
$request->addParams($params); |
146
|
|
|
$request->addFields($fields); |
147
|
|
|
return $pending ? $request : $request->execute(); |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function deleteAdLabels(array $fields = array(), array $params = array(), $pending = false) { |
151
|
|
|
$this->assureId(); |
152
|
|
|
|
153
|
|
|
$param_types = array( |
154
|
|
|
'adlabels' => 'list<Object>', |
155
|
|
|
'execution_options' => 'list<execution_options_enum>', |
156
|
|
|
); |
157
|
|
|
$enums = array( |
158
|
|
|
'execution_options_enum' => AdLabelExecutionOptionsValues::getInstance()->getValues(), |
159
|
|
|
); |
160
|
|
|
|
161
|
|
|
$request = new ApiRequest( |
162
|
|
|
$this->api, |
163
|
|
|
$this->data['id'], |
164
|
|
|
RequestInterface::METHOD_DELETE, |
165
|
|
|
'/adlabels', |
166
|
|
|
new AbstractCrudObject(), |
167
|
|
|
'EDGE', |
168
|
|
|
array(), |
169
|
|
|
new TypeChecker($param_types, $enums) |
170
|
|
|
); |
171
|
|
|
$request->addParams($params); |
172
|
|
|
$request->addFields($fields); |
173
|
|
|
return $pending ? $request : $request->execute(); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
public function createAdLabel(array $fields = array(), array $params = array(), $pending = false) { |
177
|
|
|
$this->assureId(); |
178
|
|
|
|
179
|
|
|
$param_types = array( |
180
|
|
|
'adlabels' => 'list<Object>', |
181
|
|
|
'execution_options' => 'list<execution_options_enum>', |
182
|
|
|
); |
183
|
|
|
$enums = array( |
184
|
|
|
'execution_options_enum' => AdLabelExecutionOptionsValues::getInstance()->getValues(), |
185
|
|
|
); |
186
|
|
|
|
187
|
|
|
$request = new ApiRequest( |
188
|
|
|
$this->api, |
189
|
|
|
$this->data['id'], |
190
|
|
|
RequestInterface::METHOD_POST, |
191
|
|
|
'/adlabels', |
192
|
|
|
new AdLabel(), |
193
|
|
|
'EDGE', |
194
|
|
|
AdLabel::getFieldsEnum()->getValues(), |
195
|
|
|
new TypeChecker($param_types, $enums) |
196
|
|
|
); |
197
|
|
|
$request->addParams($params); |
198
|
|
|
$request->addFields($fields); |
199
|
|
|
return $pending ? $request : $request->execute(); |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
public function getAds(array $fields = array(), array $params = array(), $pending = false) { |
203
|
|
|
$this->assureId(); |
204
|
|
|
|
205
|
|
|
$param_types = array( |
206
|
|
|
'ad_draft_id' => 'string', |
207
|
|
|
'date_preset' => 'date_preset_enum', |
208
|
|
|
'effective_status' => 'list<string>', |
209
|
|
|
'include_deleted' => 'bool', |
210
|
|
|
'time_range' => 'Object', |
211
|
|
|
'updated_since' => 'int', |
212
|
|
|
); |
213
|
|
|
$enums = array( |
214
|
|
|
'date_preset_enum' => AdDatePresetValues::getInstance()->getValues(), |
215
|
|
|
); |
216
|
|
|
|
217
|
|
|
$request = new ApiRequest( |
218
|
|
|
$this->api, |
219
|
|
|
$this->data['id'], |
220
|
|
|
RequestInterface::METHOD_GET, |
221
|
|
|
'/ads', |
222
|
|
|
new Ad(), |
223
|
|
|
'EDGE', |
224
|
|
|
Ad::getFieldsEnum()->getValues(), |
225
|
|
|
new TypeChecker($param_types, $enums) |
226
|
|
|
); |
227
|
|
|
$request->addParams($params); |
228
|
|
|
$request->addFields($fields); |
229
|
|
|
return $pending ? $request : $request->execute(); |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
public function getAsyncAdRequests(array $fields = array(), array $params = array(), $pending = false) { |
233
|
|
|
$this->assureId(); |
234
|
|
|
|
235
|
|
|
$param_types = array( |
236
|
|
|
'statuses' => 'list<statuses_enum>', |
237
|
|
|
); |
238
|
|
|
$enums = array( |
239
|
|
|
'statuses_enum' => AdAsyncRequestStatusesValues::getInstance()->getValues(), |
240
|
|
|
); |
241
|
|
|
|
242
|
|
|
$request = new ApiRequest( |
243
|
|
|
$this->api, |
244
|
|
|
$this->data['id'], |
245
|
|
|
RequestInterface::METHOD_GET, |
246
|
|
|
'/asyncadrequests', |
247
|
|
|
new AdAsyncRequest(), |
248
|
|
|
'EDGE', |
249
|
|
|
AdAsyncRequest::getFieldsEnum()->getValues(), |
250
|
|
|
new TypeChecker($param_types, $enums) |
251
|
|
|
); |
252
|
|
|
$request->addParams($params); |
253
|
|
|
$request->addFields($fields); |
254
|
|
|
return $pending ? $request : $request->execute(); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
public function getDeliveryEstimate(array $fields = array(), array $params = array(), $pending = false) { |
258
|
|
|
$this->assureId(); |
259
|
|
|
|
260
|
|
|
$param_types = array( |
261
|
|
|
'optimization_goal' => 'adcampaigndelivery_estimate_optimization_goal_enum_param', |
262
|
|
|
'promoted_object' => 'Object', |
263
|
|
|
'targeting_spec' => 'Targeting', |
264
|
|
|
); |
265
|
|
|
$enums = array( |
266
|
|
|
); |
267
|
|
|
|
268
|
|
|
$request = new ApiRequest( |
269
|
|
|
$this->api, |
270
|
|
|
$this->data['id'], |
271
|
|
|
RequestInterface::METHOD_GET, |
272
|
|
|
'/delivery_estimate', |
273
|
|
|
new DeliveryEstimate(), |
274
|
|
|
'EDGE', |
275
|
|
|
DeliveryEstimate::getFieldsEnum()->getValues(), |
276
|
|
|
new TypeChecker($param_types, $enums) |
277
|
|
|
); |
278
|
|
|
$request->addParams($params); |
279
|
|
|
$request->addFields($fields); |
280
|
|
|
return $pending ? $request : $request->execute(); |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
public function getInsights(array $fields = array(), array $params = array(), $pending = false) { |
284
|
|
|
$this->assureId(); |
285
|
|
|
|
286
|
|
|
$param_types = array( |
287
|
|
|
'action_attribution_windows' => 'list<action_attribution_windows_enum>', |
288
|
|
|
'action_breakdowns' => 'list<action_breakdowns_enum>', |
289
|
|
|
'action_report_time' => 'action_report_time_enum', |
290
|
|
|
'breakdowns' => 'list<breakdowns_enum>', |
291
|
|
|
'date_preset' => 'date_preset_enum', |
292
|
|
|
'default_summary' => 'bool', |
293
|
|
|
'export_columns' => 'list<string>', |
294
|
|
|
'export_format' => 'string', |
295
|
|
|
'export_name' => 'string', |
296
|
|
|
'fields' => 'list<fields_enum>', |
297
|
|
|
'filtering' => 'list<Object>', |
298
|
|
|
'level' => 'level_enum', |
299
|
|
|
'product_id_limit' => 'int', |
300
|
|
|
'sort' => 'list<string>', |
301
|
|
|
'summary' => 'list<summary_enum>', |
302
|
|
|
'summary_action_breakdowns' => 'list<summary_action_breakdowns_enum>', |
303
|
|
|
'time_increment' => 'string', |
304
|
|
|
'time_range' => 'Object', |
305
|
|
|
'time_ranges' => 'list<Object>', |
306
|
|
|
); |
307
|
|
|
$enums = array( |
308
|
|
|
'action_attribution_windows_enum' => AdsInsightsActionAttributionWindowsValues::getInstance()->getValues(), |
309
|
|
|
'action_breakdowns_enum' => AdsInsightsActionBreakdownsValues::getInstance()->getValues(), |
310
|
|
|
'action_report_time_enum' => AdsInsightsActionReportTimeValues::getInstance()->getValues(), |
311
|
|
|
'breakdowns_enum' => AdsInsightsBreakdownsValues::getInstance()->getValues(), |
312
|
|
|
'date_preset_enum' => AdsInsightsDatePresetValues::getInstance()->getValues(), |
313
|
|
|
'summary_enum' => AdsInsightsSummaryValues::getInstance()->getValues(), |
314
|
|
|
'level_enum' => AdsInsightsLevelValues::getInstance()->getValues(), |
315
|
|
|
'summary_action_breakdowns_enum' => AdsInsightsSummaryActionBreakdownsValues::getInstance()->getValues(), |
316
|
|
|
); |
317
|
|
|
|
318
|
|
|
$request = new ApiRequest( |
319
|
|
|
$this->api, |
320
|
|
|
$this->data['id'], |
321
|
|
|
RequestInterface::METHOD_GET, |
322
|
|
|
'/insights', |
323
|
|
|
new AdsInsights(), |
324
|
|
|
'EDGE', |
325
|
|
|
AdsInsights::getFieldsEnum()->getValues(), |
326
|
|
|
new TypeChecker($param_types, $enums) |
327
|
|
|
); |
328
|
|
|
$request->addParams($params); |
329
|
|
|
$request->addFields($fields); |
330
|
|
|
return $pending ? $request : $request->execute(); |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
public function getInsightsAsync(array $fields = array(), array $params = array(), $pending = false) { |
334
|
|
|
$this->assureId(); |
335
|
|
|
|
336
|
|
|
$param_types = array( |
337
|
|
|
'action_attribution_windows' => 'list<action_attribution_windows_enum>', |
338
|
|
|
'action_breakdowns' => 'list<action_breakdowns_enum>', |
339
|
|
|
'action_report_time' => 'action_report_time_enum', |
340
|
|
|
'breakdowns' => 'list<breakdowns_enum>', |
341
|
|
|
'date_preset' => 'date_preset_enum', |
342
|
|
|
'default_summary' => 'bool', |
343
|
|
|
'export_columns' => 'list<string>', |
344
|
|
|
'export_format' => 'string', |
345
|
|
|
'export_name' => 'string', |
346
|
|
|
'fields' => 'list<fields_enum>', |
347
|
|
|
'filtering' => 'list<Object>', |
348
|
|
|
'level' => 'level_enum', |
349
|
|
|
'product_id_limit' => 'int', |
350
|
|
|
'sort' => 'list<string>', |
351
|
|
|
'summary' => 'list<summary_enum>', |
352
|
|
|
'summary_action_breakdowns' => 'list<summary_action_breakdowns_enum>', |
353
|
|
|
'time_increment' => 'string', |
354
|
|
|
'time_range' => 'Object', |
355
|
|
|
'time_ranges' => 'list<Object>', |
356
|
|
|
); |
357
|
|
|
$enums = array( |
358
|
|
|
'action_attribution_windows_enum' => AdsInsightsActionAttributionWindowsValues::getInstance()->getValues(), |
359
|
|
|
'action_breakdowns_enum' => AdsInsightsActionBreakdownsValues::getInstance()->getValues(), |
360
|
|
|
'action_report_time_enum' => AdsInsightsActionReportTimeValues::getInstance()->getValues(), |
361
|
|
|
'breakdowns_enum' => AdsInsightsBreakdownsValues::getInstance()->getValues(), |
362
|
|
|
'date_preset_enum' => AdsInsightsDatePresetValues::getInstance()->getValues(), |
363
|
|
|
'summary_enum' => AdsInsightsSummaryValues::getInstance()->getValues(), |
364
|
|
|
'level_enum' => AdsInsightsLevelValues::getInstance()->getValues(), |
365
|
|
|
'summary_action_breakdowns_enum' => AdsInsightsSummaryActionBreakdownsValues::getInstance()->getValues(), |
366
|
|
|
); |
367
|
|
|
|
368
|
|
|
$request = new ApiRequest( |
369
|
|
|
$this->api, |
370
|
|
|
$this->data['id'], |
371
|
|
|
RequestInterface::METHOD_POST, |
372
|
|
|
'/insights', |
373
|
|
|
new AdReportRun(), |
374
|
|
|
'EDGE', |
375
|
|
|
AdReportRun::getFieldsEnum()->getValues(), |
376
|
|
|
new TypeChecker($param_types, $enums) |
377
|
|
|
); |
378
|
|
|
$request->addParams($params); |
379
|
|
|
$request->addFields($fields); |
380
|
|
|
return $pending ? $request : $request->execute(); |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
public function getTargetingSentenceLines(array $fields = array(), array $params = array(), $pending = false) { |
384
|
|
|
$this->assureId(); |
385
|
|
|
|
386
|
|
|
$param_types = array( |
387
|
|
|
); |
388
|
|
|
$enums = array( |
389
|
|
|
); |
390
|
|
|
|
391
|
|
|
$request = new ApiRequest( |
392
|
|
|
$this->api, |
393
|
|
|
$this->data['id'], |
394
|
|
|
RequestInterface::METHOD_GET, |
395
|
|
|
'/targetingsentencelines', |
396
|
|
|
new TargetingSentenceLine(), |
397
|
|
|
'EDGE', |
398
|
|
|
TargetingSentenceLine::getFieldsEnum()->getValues(), |
399
|
|
|
new TypeChecker($param_types, $enums) |
400
|
|
|
); |
401
|
|
|
$request->addParams($params); |
402
|
|
|
$request->addFields($fields); |
403
|
|
|
return $pending ? $request : $request->execute(); |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) { |
407
|
|
|
$this->assureId(); |
408
|
|
|
|
409
|
|
|
$param_types = array( |
410
|
|
|
); |
411
|
|
|
$enums = array( |
412
|
|
|
); |
413
|
|
|
|
414
|
|
|
$request = new ApiRequest( |
415
|
|
|
$this->api, |
416
|
|
|
$this->data['id'], |
417
|
|
|
RequestInterface::METHOD_DELETE, |
418
|
|
|
'/', |
419
|
|
|
new AbstractCrudObject(), |
420
|
|
|
'NODE', |
421
|
|
|
array(), |
422
|
|
|
new TypeChecker($param_types, $enums) |
423
|
|
|
); |
424
|
|
|
$request->addParams($params); |
425
|
|
|
$request->addFields($fields); |
426
|
|
|
return $pending ? $request : $request->execute(); |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
public function getSelf(array $fields = array(), array $params = array(), $pending = false) { |
430
|
|
|
$this->assureId(); |
431
|
|
|
|
432
|
|
|
$param_types = array( |
433
|
|
|
); |
434
|
|
|
$enums = array( |
435
|
|
|
); |
436
|
|
|
|
437
|
|
|
$request = new ApiRequest( |
438
|
|
|
$this->api, |
439
|
|
|
$this->data['id'], |
440
|
|
|
RequestInterface::METHOD_GET, |
441
|
|
|
'/', |
442
|
|
|
new AdSet(), |
443
|
|
|
'NODE', |
444
|
|
|
AdSet::getFieldsEnum()->getValues(), |
445
|
|
|
new TypeChecker($param_types, $enums) |
446
|
|
|
); |
447
|
|
|
$request->addParams($params); |
448
|
|
|
$request->addFields($fields); |
449
|
|
|
return $pending ? $request : $request->execute(); |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
public function updateSelf(array $fields = array(), array $params = array(), $pending = false) { |
453
|
|
|
$this->assureId(); |
454
|
|
|
|
455
|
|
|
$param_types = array( |
456
|
|
|
'account_id' => 'string', |
457
|
|
|
'adlabels' => 'list<Object>', |
458
|
|
|
'adset_schedule' => 'list<Object>', |
459
|
|
|
'attribution_spec' => 'list<map>', |
460
|
|
|
'bid_amount' => 'int', |
461
|
|
|
'billing_event' => 'billing_event_enum', |
462
|
|
|
'creative_sequence' => 'list<string>', |
463
|
|
|
'daily_budget' => 'unsigned int', |
464
|
|
|
'daily_imps' => 'unsigned int', |
465
|
|
|
'end_time' => 'datetime', |
466
|
|
|
'execution_options' => 'list<execution_options_enum>', |
467
|
|
|
'is_autobid' => 'bool', |
468
|
|
|
'is_average_price_pacing' => 'bool', |
469
|
|
|
'lifetime_budget' => 'unsigned int', |
470
|
|
|
'lifetime_imps' => 'unsigned int', |
471
|
|
|
'name' => 'string', |
472
|
|
|
'optimization_goal' => 'optimization_goal_enum', |
473
|
|
|
'pacing_type' => 'list<string>', |
474
|
|
|
'promoted_object' => 'Object', |
475
|
|
|
'redownload' => 'bool', |
476
|
|
|
'rf_prediction_id' => 'string', |
477
|
|
|
'start_time' => 'datetime', |
478
|
|
|
'status' => 'status_enum', |
479
|
|
|
'targeting' => 'Targeting', |
480
|
|
|
'time_based_ad_rotation_id_blocks' => 'list<list<unsigned int>>', |
481
|
|
|
'time_based_ad_rotation_intervals' => 'list<unsigned int>', |
482
|
|
|
); |
483
|
|
|
$enums = array( |
484
|
|
|
'billing_event_enum' => AdSetBillingEventValues::getInstance()->getValues(), |
485
|
|
|
'execution_options_enum' => AdSetExecutionOptionsValues::getInstance()->getValues(), |
486
|
|
|
'optimization_goal_enum' => AdSetOptimizationGoalValues::getInstance()->getValues(), |
487
|
|
|
'status_enum' => AdSetStatusValues::getInstance()->getValues(), |
488
|
|
|
); |
489
|
|
|
|
490
|
|
|
$request = new ApiRequest( |
491
|
|
|
$this->api, |
492
|
|
|
$this->data['id'], |
493
|
|
|
RequestInterface::METHOD_POST, |
494
|
|
|
'/', |
495
|
|
|
new AdSet(), |
496
|
|
|
'NODE', |
497
|
|
|
AdSet::getFieldsEnum()->getValues(), |
498
|
|
|
new TypeChecker($param_types, $enums) |
499
|
|
|
); |
500
|
|
|
$request->addParams($params); |
501
|
|
|
$request->addFields($fields); |
502
|
|
|
return $pending ? $request : $request->execute(); |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
} |
506
|
|
|
|