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\AdCampaignDeliveryEstimateOptimizationGoalValues; |
35
|
|
|
use FacebookAds\Object\Values\AdDatePresetValues; |
36
|
|
|
use FacebookAds\Object\Values\AdLabelExecutionOptionsValues; |
37
|
|
|
use FacebookAds\Object\Values\AdSetBillingEventValues; |
38
|
|
|
use FacebookAds\Object\Values\AdSetConfiguredStatusValues; |
39
|
|
|
use FacebookAds\Object\Values\AdSetDatePresetValues; |
40
|
|
|
use FacebookAds\Object\Values\AdSetDestinationTypeValues; |
41
|
|
|
use FacebookAds\Object\Values\AdSetEffectiveStatusValues; |
42
|
|
|
use FacebookAds\Object\Values\AdSetExecutionOptionsValues; |
43
|
|
|
use FacebookAds\Object\Values\AdSetOperatorValues; |
44
|
|
|
use FacebookAds\Object\Values\AdSetOptimizationGoalValues; |
45
|
|
|
use FacebookAds\Object\Values\AdSetStatusValues; |
46
|
|
|
use FacebookAds\Object\Values\AdsInsightsActionAttributionWindowsValues; |
47
|
|
|
use FacebookAds\Object\Values\AdsInsightsActionBreakdownsValues; |
48
|
|
|
use FacebookAds\Object\Values\AdsInsightsActionReportTimeValues; |
49
|
|
|
use FacebookAds\Object\Values\AdsInsightsBreakdownsValues; |
50
|
|
|
use FacebookAds\Object\Values\AdsInsightsDatePresetValues; |
51
|
|
|
use FacebookAds\Object\Values\AdsInsightsLevelValues; |
52
|
|
|
use FacebookAds\Object\Values\AdsInsightsSummaryActionBreakdownsValues; |
53
|
|
|
use FacebookAds\Object\Values\AdsInsightsSummaryValues; |
54
|
|
|
use FacebookAds\Object\Traits\AdLabelAwareCrudObjectTrait; |
55
|
|
|
use FacebookAds\Object\Traits\ObjectValidation; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* This class is auto-generated. |
59
|
|
|
* |
60
|
|
|
* For any issues or feature requests related to this class, please let us know |
61
|
|
|
* on github and we'll fix in our codegen framework. We'll not be able to accept |
62
|
|
|
* pull request for this class. |
63
|
|
|
* |
64
|
|
|
*/ |
65
|
|
|
|
66
|
|
|
class AdSet extends AbstractArchivableCrudObject |
67
|
|
|
implements CanRedownloadInterface { |
68
|
|
|
|
69
|
|
|
use AdLabelAwareCrudObjectTrait; |
70
|
|
|
use ObjectValidation; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @deprecated getEndpoint function is deprecated |
74
|
|
|
*/ |
75
|
|
|
protected function getEndpoint() { |
76
|
|
|
return 'adsets'; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return AdSetFields |
81
|
|
|
*/ |
82
|
|
|
public static function getFieldsEnum() { |
83
|
|
|
return AdSetFields::getInstance(); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
protected static function getReferencedEnums() { |
87
|
|
|
$ref_enums = array(); |
88
|
|
|
$ref_enums['BillingEvent'] = AdSetBillingEventValues::getInstance()->getValues(); |
89
|
|
|
$ref_enums['ConfiguredStatus'] = AdSetConfiguredStatusValues::getInstance()->getValues(); |
90
|
|
|
$ref_enums['EffectiveStatus'] = AdSetEffectiveStatusValues::getInstance()->getValues(); |
91
|
|
|
$ref_enums['OptimizationGoal'] = AdSetOptimizationGoalValues::getInstance()->getValues(); |
92
|
|
|
$ref_enums['Status'] = AdSetStatusValues::getInstance()->getValues(); |
93
|
|
|
$ref_enums['DatePreset'] = AdSetDatePresetValues::getInstance()->getValues(); |
94
|
|
|
$ref_enums['DestinationType'] = AdSetDestinationTypeValues::getInstance()->getValues(); |
95
|
|
|
$ref_enums['ExecutionOptions'] = AdSetExecutionOptionsValues::getInstance()->getValues(); |
96
|
|
|
$ref_enums['Operator'] = AdSetOperatorValues::getInstance()->getValues(); |
97
|
|
|
return $ref_enums; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
|
101
|
|
|
public function getActivities(array $fields = array(), array $params = array(), $pending = false) { |
102
|
|
|
$this->assureId(); |
103
|
|
|
|
104
|
|
|
$param_types = array( |
105
|
|
|
'business_id' => 'string', |
106
|
|
|
'category' => 'category_enum', |
107
|
|
|
'since' => 'datetime', |
108
|
|
|
'uid' => 'int', |
109
|
|
|
'until' => 'datetime', |
110
|
|
|
); |
111
|
|
|
$enums = array( |
112
|
|
|
'category_enum' => AdActivityCategoryValues::getInstance()->getValues(), |
113
|
|
|
); |
114
|
|
|
|
115
|
|
|
$request = new ApiRequest( |
116
|
|
|
$this->api, |
117
|
|
|
$this->data['id'], |
118
|
|
|
RequestInterface::METHOD_GET, |
119
|
|
|
'/activities', |
120
|
|
|
new AdActivity(), |
121
|
|
|
'EDGE', |
122
|
|
|
AdActivity::getFieldsEnum()->getValues(), |
123
|
|
|
new TypeChecker($param_types, $enums) |
124
|
|
|
); |
125
|
|
|
$request->addParams($params); |
126
|
|
|
$request->addFields($fields); |
127
|
|
|
return $pending ? $request : $request->execute(); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function getAdCreatives(array $fields = array(), array $params = array(), $pending = false) { |
131
|
|
|
$this->assureId(); |
132
|
|
|
|
133
|
|
|
$param_types = array( |
134
|
|
|
); |
135
|
|
|
$enums = array( |
136
|
|
|
); |
137
|
|
|
|
138
|
|
|
$request = new ApiRequest( |
139
|
|
|
$this->api, |
140
|
|
|
$this->data['id'], |
141
|
|
|
RequestInterface::METHOD_GET, |
142
|
|
|
'/adcreatives', |
143
|
|
|
new AdCreative(), |
144
|
|
|
'EDGE', |
145
|
|
|
AdCreative::getFieldsEnum()->getValues(), |
146
|
|
|
new TypeChecker($param_types, $enums) |
147
|
|
|
); |
148
|
|
|
$request->addParams($params); |
149
|
|
|
$request->addFields($fields); |
150
|
|
|
return $pending ? $request : $request->execute(); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
public function deleteAdLabels(array $fields = array(), array $params = array(), $pending = false) { |
154
|
|
|
$this->assureId(); |
155
|
|
|
|
156
|
|
|
$param_types = array( |
157
|
|
|
'adlabels' => 'list<Object>', |
158
|
|
|
'execution_options' => 'list<execution_options_enum>', |
159
|
|
|
); |
160
|
|
|
$enums = array( |
161
|
|
|
'execution_options_enum' => AdLabelExecutionOptionsValues::getInstance()->getValues(), |
162
|
|
|
); |
163
|
|
|
|
164
|
|
|
$request = new ApiRequest( |
165
|
|
|
$this->api, |
166
|
|
|
$this->data['id'], |
167
|
|
|
RequestInterface::METHOD_DELETE, |
168
|
|
|
'/adlabels', |
169
|
|
|
new AbstractCrudObject(), |
170
|
|
|
'EDGE', |
171
|
|
|
array(), |
172
|
|
|
new TypeChecker($param_types, $enums) |
173
|
|
|
); |
174
|
|
|
$request->addParams($params); |
175
|
|
|
$request->addFields($fields); |
176
|
|
|
return $pending ? $request : $request->execute(); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
public function createAdLabel(array $fields = array(), array $params = array(), $pending = false) { |
180
|
|
|
$this->assureId(); |
181
|
|
|
|
182
|
|
|
$param_types = array( |
183
|
|
|
'adlabels' => 'list<Object>', |
184
|
|
|
'execution_options' => 'list<execution_options_enum>', |
185
|
|
|
); |
186
|
|
|
$enums = array( |
187
|
|
|
'execution_options_enum' => AdLabelExecutionOptionsValues::getInstance()->getValues(), |
188
|
|
|
); |
189
|
|
|
|
190
|
|
|
$request = new ApiRequest( |
191
|
|
|
$this->api, |
192
|
|
|
$this->data['id'], |
193
|
|
|
RequestInterface::METHOD_POST, |
194
|
|
|
'/adlabels', |
195
|
|
|
new AdLabel(), |
196
|
|
|
'EDGE', |
197
|
|
|
AdLabel::getFieldsEnum()->getValues(), |
198
|
|
|
new TypeChecker($param_types, $enums) |
199
|
|
|
); |
200
|
|
|
$request->addParams($params); |
201
|
|
|
$request->addFields($fields); |
202
|
|
|
return $pending ? $request : $request->execute(); |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public function getAds(array $fields = array(), array $params = array(), $pending = false) { |
206
|
|
|
$this->assureId(); |
207
|
|
|
|
208
|
|
|
$param_types = array( |
209
|
|
|
'ad_draft_id' => 'string', |
210
|
|
|
'date_preset' => 'date_preset_enum', |
211
|
|
|
'effective_status' => 'list<string>', |
212
|
|
|
'include_deleted' => 'bool', |
213
|
|
|
'time_range' => 'Object', |
214
|
|
|
'updated_since' => 'int', |
215
|
|
|
); |
216
|
|
|
$enums = array( |
217
|
|
|
'date_preset_enum' => AdDatePresetValues::getInstance()->getValues(), |
218
|
|
|
); |
219
|
|
|
|
220
|
|
|
$request = new ApiRequest( |
221
|
|
|
$this->api, |
222
|
|
|
$this->data['id'], |
223
|
|
|
RequestInterface::METHOD_GET, |
224
|
|
|
'/ads', |
225
|
|
|
new Ad(), |
226
|
|
|
'EDGE', |
227
|
|
|
Ad::getFieldsEnum()->getValues(), |
228
|
|
|
new TypeChecker($param_types, $enums) |
229
|
|
|
); |
230
|
|
|
$request->addParams($params); |
231
|
|
|
$request->addFields($fields); |
232
|
|
|
return $pending ? $request : $request->execute(); |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
public function getAsyncAdRequests(array $fields = array(), array $params = array(), $pending = false) { |
236
|
|
|
$this->assureId(); |
237
|
|
|
|
238
|
|
|
$param_types = array( |
239
|
|
|
'statuses' => 'list<statuses_enum>', |
240
|
|
|
); |
241
|
|
|
$enums = array( |
242
|
|
|
'statuses_enum' => AdAsyncRequestStatusesValues::getInstance()->getValues(), |
243
|
|
|
); |
244
|
|
|
|
245
|
|
|
$request = new ApiRequest( |
246
|
|
|
$this->api, |
247
|
|
|
$this->data['id'], |
248
|
|
|
RequestInterface::METHOD_GET, |
249
|
|
|
'/asyncadrequests', |
250
|
|
|
new AdAsyncRequest(), |
251
|
|
|
'EDGE', |
252
|
|
|
AdAsyncRequest::getFieldsEnum()->getValues(), |
253
|
|
|
new TypeChecker($param_types, $enums) |
254
|
|
|
); |
255
|
|
|
$request->addParams($params); |
256
|
|
|
$request->addFields($fields); |
257
|
|
|
return $pending ? $request : $request->execute(); |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
public function getCopies(array $fields = array(), array $params = array(), $pending = false) { |
261
|
|
|
$this->assureId(); |
262
|
|
|
|
263
|
|
|
$param_types = array( |
264
|
|
|
'date_preset' => 'date_preset_enum', |
265
|
|
|
'effective_status' => 'list<effective_status_enum>', |
266
|
|
|
'is_completed' => 'bool', |
267
|
|
|
'time_range' => 'Object', |
268
|
|
|
); |
269
|
|
|
$enums = array( |
270
|
|
|
'date_preset_enum' => AdSetDatePresetValues::getInstance()->getValues(), |
271
|
|
|
'effective_status_enum' => AdSetEffectiveStatusValues::getInstance()->getValues(), |
272
|
|
|
); |
273
|
|
|
|
274
|
|
|
$request = new ApiRequest( |
275
|
|
|
$this->api, |
276
|
|
|
$this->data['id'], |
277
|
|
|
RequestInterface::METHOD_GET, |
278
|
|
|
'/copies', |
279
|
|
|
new AdSet(), |
280
|
|
|
'EDGE', |
281
|
|
|
AdSet::getFieldsEnum()->getValues(), |
282
|
|
|
new TypeChecker($param_types, $enums) |
283
|
|
|
); |
284
|
|
|
$request->addParams($params); |
285
|
|
|
$request->addFields($fields); |
286
|
|
|
return $pending ? $request : $request->execute(); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
public function getDeliveryEstimate(array $fields = array(), array $params = array(), $pending = false) { |
290
|
|
|
$this->assureId(); |
291
|
|
|
|
292
|
|
|
$param_types = array( |
293
|
|
|
'optimization_goal' => 'optimization_goal_enum', |
294
|
|
|
'promoted_object' => 'Object', |
295
|
|
|
'targeting_spec' => 'Targeting', |
296
|
|
|
); |
297
|
|
|
$enums = array( |
298
|
|
|
'optimization_goal_enum' => AdCampaignDeliveryEstimateOptimizationGoalValues::getInstance()->getValues(), |
299
|
|
|
); |
300
|
|
|
|
301
|
|
|
$request = new ApiRequest( |
302
|
|
|
$this->api, |
303
|
|
|
$this->data['id'], |
304
|
|
|
RequestInterface::METHOD_GET, |
305
|
|
|
'/delivery_estimate', |
306
|
|
|
new AdCampaignDeliveryEstimate(), |
307
|
|
|
'EDGE', |
308
|
|
|
AdCampaignDeliveryEstimate::getFieldsEnum()->getValues(), |
309
|
|
|
new TypeChecker($param_types, $enums) |
310
|
|
|
); |
311
|
|
|
$request->addParams($params); |
312
|
|
|
$request->addFields($fields); |
313
|
|
|
return $pending ? $request : $request->execute(); |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
public function getInsights(array $fields = array(), array $params = array(), $pending = false) { |
317
|
|
|
$this->assureId(); |
318
|
|
|
|
319
|
|
|
$param_types = array( |
320
|
|
|
'action_attribution_windows' => 'list<action_attribution_windows_enum>', |
321
|
|
|
'action_breakdowns' => 'list<action_breakdowns_enum>', |
322
|
|
|
'action_report_time' => 'action_report_time_enum', |
323
|
|
|
'breakdowns' => 'list<breakdowns_enum>', |
324
|
|
|
'date_preset' => 'date_preset_enum', |
325
|
|
|
'default_summary' => 'bool', |
326
|
|
|
'export_columns' => 'list<string>', |
327
|
|
|
'export_format' => 'string', |
328
|
|
|
'export_name' => 'string', |
329
|
|
|
'fields' => 'list<fields_enum>', |
330
|
|
|
'filtering' => 'list<Object>', |
331
|
|
|
'level' => 'level_enum', |
332
|
|
|
'product_id_limit' => 'int', |
333
|
|
|
'sort' => 'list<string>', |
334
|
|
|
'summary' => 'list<summary_enum>', |
335
|
|
|
'summary_action_breakdowns' => 'list<summary_action_breakdowns_enum>', |
336
|
|
|
'time_increment' => 'string', |
337
|
|
|
'time_range' => 'Object', |
338
|
|
|
'time_ranges' => 'list<Object>', |
339
|
|
|
'use_account_attribution_setting' => 'bool', |
340
|
|
|
); |
341
|
|
|
$enums = array( |
342
|
|
|
'action_attribution_windows_enum' => AdsInsightsActionAttributionWindowsValues::getInstance()->getValues(), |
343
|
|
|
'action_breakdowns_enum' => AdsInsightsActionBreakdownsValues::getInstance()->getValues(), |
344
|
|
|
'action_report_time_enum' => AdsInsightsActionReportTimeValues::getInstance()->getValues(), |
345
|
|
|
'breakdowns_enum' => AdsInsightsBreakdownsValues::getInstance()->getValues(), |
346
|
|
|
'date_preset_enum' => AdsInsightsDatePresetValues::getInstance()->getValues(), |
347
|
|
|
'summary_enum' => AdsInsightsSummaryValues::getInstance()->getValues(), |
348
|
|
|
'level_enum' => AdsInsightsLevelValues::getInstance()->getValues(), |
349
|
|
|
'summary_action_breakdowns_enum' => AdsInsightsSummaryActionBreakdownsValues::getInstance()->getValues(), |
350
|
|
|
); |
351
|
|
|
|
352
|
|
|
$request = new ApiRequest( |
353
|
|
|
$this->api, |
354
|
|
|
$this->data['id'], |
355
|
|
|
RequestInterface::METHOD_GET, |
356
|
|
|
'/insights', |
357
|
|
|
new AdsInsights(), |
358
|
|
|
'EDGE', |
359
|
|
|
AdsInsights::getFieldsEnum()->getValues(), |
360
|
|
|
new TypeChecker($param_types, $enums) |
361
|
|
|
); |
362
|
|
|
$request->addParams($params); |
363
|
|
|
$request->addFields($fields); |
364
|
|
|
return $pending ? $request : $request->execute(); |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
public function getInsightsAsync(array $fields = array(), array $params = array(), $pending = false) { |
368
|
|
|
$this->assureId(); |
369
|
|
|
|
370
|
|
|
$param_types = array( |
371
|
|
|
'action_attribution_windows' => 'list<action_attribution_windows_enum>', |
372
|
|
|
'action_breakdowns' => 'list<action_breakdowns_enum>', |
373
|
|
|
'action_report_time' => 'action_report_time_enum', |
374
|
|
|
'breakdowns' => 'list<breakdowns_enum>', |
375
|
|
|
'date_preset' => 'date_preset_enum', |
376
|
|
|
'default_summary' => 'bool', |
377
|
|
|
'export_columns' => 'list<string>', |
378
|
|
|
'export_format' => 'string', |
379
|
|
|
'export_name' => 'string', |
380
|
|
|
'fields' => 'list<fields_enum>', |
381
|
|
|
'filtering' => 'list<Object>', |
382
|
|
|
'level' => 'level_enum', |
383
|
|
|
'product_id_limit' => 'int', |
384
|
|
|
'sort' => 'list<string>', |
385
|
|
|
'summary' => 'list<summary_enum>', |
386
|
|
|
'summary_action_breakdowns' => 'list<summary_action_breakdowns_enum>', |
387
|
|
|
'time_increment' => 'string', |
388
|
|
|
'time_range' => 'Object', |
389
|
|
|
'time_ranges' => 'list<Object>', |
390
|
|
|
'use_account_attribution_setting' => 'bool', |
391
|
|
|
); |
392
|
|
|
$enums = array( |
393
|
|
|
'action_attribution_windows_enum' => AdsInsightsActionAttributionWindowsValues::getInstance()->getValues(), |
394
|
|
|
'action_breakdowns_enum' => AdsInsightsActionBreakdownsValues::getInstance()->getValues(), |
395
|
|
|
'action_report_time_enum' => AdsInsightsActionReportTimeValues::getInstance()->getValues(), |
396
|
|
|
'breakdowns_enum' => AdsInsightsBreakdownsValues::getInstance()->getValues(), |
397
|
|
|
'date_preset_enum' => AdsInsightsDatePresetValues::getInstance()->getValues(), |
398
|
|
|
'summary_enum' => AdsInsightsSummaryValues::getInstance()->getValues(), |
399
|
|
|
'level_enum' => AdsInsightsLevelValues::getInstance()->getValues(), |
400
|
|
|
'summary_action_breakdowns_enum' => AdsInsightsSummaryActionBreakdownsValues::getInstance()->getValues(), |
401
|
|
|
); |
402
|
|
|
|
403
|
|
|
$request = new ApiRequest( |
404
|
|
|
$this->api, |
405
|
|
|
$this->data['id'], |
406
|
|
|
RequestInterface::METHOD_POST, |
407
|
|
|
'/insights', |
408
|
|
|
new AdReportRun(), |
409
|
|
|
'EDGE', |
410
|
|
|
AdReportRun::getFieldsEnum()->getValues(), |
411
|
|
|
new TypeChecker($param_types, $enums) |
412
|
|
|
); |
413
|
|
|
$request->addParams($params); |
414
|
|
|
$request->addFields($fields); |
415
|
|
|
return $pending ? $request : $request->execute(); |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
public function getTargetingSentenceLines(array $fields = array(), array $params = array(), $pending = false) { |
419
|
|
|
$this->assureId(); |
420
|
|
|
|
421
|
|
|
$param_types = array( |
422
|
|
|
); |
423
|
|
|
$enums = array( |
424
|
|
|
); |
425
|
|
|
|
426
|
|
|
$request = new ApiRequest( |
427
|
|
|
$this->api, |
428
|
|
|
$this->data['id'], |
429
|
|
|
RequestInterface::METHOD_GET, |
430
|
|
|
'/targetingsentencelines', |
431
|
|
|
new TargetingSentenceLine(), |
432
|
|
|
'EDGE', |
433
|
|
|
TargetingSentenceLine::getFieldsEnum()->getValues(), |
434
|
|
|
new TypeChecker($param_types, $enums) |
435
|
|
|
); |
436
|
|
|
$request->addParams($params); |
437
|
|
|
$request->addFields($fields); |
438
|
|
|
return $pending ? $request : $request->execute(); |
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) { |
442
|
|
|
$this->assureId(); |
443
|
|
|
|
444
|
|
|
$param_types = array( |
445
|
|
|
); |
446
|
|
|
$enums = array( |
447
|
|
|
); |
448
|
|
|
|
449
|
|
|
$request = new ApiRequest( |
450
|
|
|
$this->api, |
451
|
|
|
$this->data['id'], |
452
|
|
|
RequestInterface::METHOD_DELETE, |
453
|
|
|
'/', |
454
|
|
|
new AbstractCrudObject(), |
455
|
|
|
'NODE', |
456
|
|
|
array(), |
457
|
|
|
new TypeChecker($param_types, $enums) |
458
|
|
|
); |
459
|
|
|
$request->addParams($params); |
460
|
|
|
$request->addFields($fields); |
461
|
|
|
return $pending ? $request : $request->execute(); |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
public function getSelf(array $fields = array(), array $params = array(), $pending = false) { |
465
|
|
|
$this->assureId(); |
466
|
|
|
|
467
|
|
|
$param_types = array( |
468
|
|
|
); |
469
|
|
|
$enums = array( |
470
|
|
|
); |
471
|
|
|
|
472
|
|
|
$request = new ApiRequest( |
473
|
|
|
$this->api, |
474
|
|
|
$this->data['id'], |
475
|
|
|
RequestInterface::METHOD_GET, |
476
|
|
|
'/', |
477
|
|
|
new AdSet(), |
478
|
|
|
'NODE', |
479
|
|
|
AdSet::getFieldsEnum()->getValues(), |
480
|
|
|
new TypeChecker($param_types, $enums) |
481
|
|
|
); |
482
|
|
|
$request->addParams($params); |
483
|
|
|
$request->addFields($fields); |
484
|
|
|
return $pending ? $request : $request->execute(); |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
public function updateSelf(array $fields = array(), array $params = array(), $pending = false) { |
488
|
|
|
$this->assureId(); |
489
|
|
|
|
490
|
|
|
$param_types = array( |
491
|
|
|
'account_id' => 'string', |
492
|
|
|
'adlabels' => 'list<Object>', |
493
|
|
|
'adset_schedule' => 'list<Object>', |
494
|
|
|
'attribution_spec' => 'list<map>', |
495
|
|
|
'bid_amount' => 'int', |
496
|
|
|
'billing_event' => 'billing_event_enum', |
497
|
|
|
'creative_sequence' => 'list<string>', |
498
|
|
|
'daily_budget' => 'unsigned int', |
499
|
|
|
'daily_imps' => 'unsigned int', |
500
|
|
|
'destination_type' => 'destination_type_enum', |
501
|
|
|
'end_time' => 'datetime', |
502
|
|
|
'execution_options' => 'list<execution_options_enum>', |
503
|
|
|
'is_autobid' => 'bool', |
504
|
|
|
'is_average_price_pacing' => 'bool', |
505
|
|
|
'lifetime_budget' => 'unsigned int', |
506
|
|
|
'lifetime_imps' => 'unsigned int', |
507
|
|
|
'name' => 'string', |
508
|
|
|
'optimization_goal' => 'optimization_goal_enum', |
509
|
|
|
'pacing_type' => 'list<string>', |
510
|
|
|
'promoted_object' => 'Object', |
511
|
|
|
'redownload' => 'bool', |
512
|
|
|
'rf_prediction_id' => 'string', |
513
|
|
|
'start_time' => 'datetime', |
514
|
|
|
'status' => 'status_enum', |
515
|
|
|
'targeting' => 'Targeting', |
516
|
|
|
'time_based_ad_rotation_id_blocks' => 'list<list<unsigned int>>', |
517
|
|
|
'time_based_ad_rotation_intervals' => 'list<unsigned int>', |
518
|
|
|
); |
519
|
|
|
$enums = array( |
520
|
|
|
'billing_event_enum' => AdSetBillingEventValues::getInstance()->getValues(), |
521
|
|
|
'destination_type_enum' => AdSetDestinationTypeValues::getInstance()->getValues(), |
522
|
|
|
'execution_options_enum' => AdSetExecutionOptionsValues::getInstance()->getValues(), |
523
|
|
|
'optimization_goal_enum' => AdSetOptimizationGoalValues::getInstance()->getValues(), |
524
|
|
|
'status_enum' => AdSetStatusValues::getInstance()->getValues(), |
525
|
|
|
); |
526
|
|
|
|
527
|
|
|
$request = new ApiRequest( |
528
|
|
|
$this->api, |
529
|
|
|
$this->data['id'], |
530
|
|
|
RequestInterface::METHOD_POST, |
531
|
|
|
'/', |
532
|
|
|
new AdSet(), |
533
|
|
|
'NODE', |
534
|
|
|
AdSet::getFieldsEnum()->getValues(), |
535
|
|
|
new TypeChecker($param_types, $enums) |
536
|
|
|
); |
537
|
|
|
$request->addParams($params); |
538
|
|
|
$request->addFields($fields); |
539
|
|
|
return $pending ? $request : $request->execute(); |
540
|
|
|
} |
541
|
|
|
|
542
|
|
|
} |
543
|
|
|
|