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