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\AdStudyFields; |
32
|
|
|
use FacebookAds\Object\Values\AdStudyObjectiveTypeValues; |
33
|
|
|
use FacebookAds\Object\Values\AdStudyTypeValues; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* This class is auto-genereated. |
37
|
|
|
* |
38
|
|
|
* For any issues or feature requests related to this class, please let us know |
39
|
|
|
* on github and we'll fix in our codegen framework. We'll not be able to accept |
40
|
|
|
* pull request for this class. |
41
|
|
|
* |
42
|
|
|
*/ |
43
|
|
|
|
44
|
|
|
class AdStudy extends AbstractCrudObject { |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @deprecated getEndpoint function is deprecated |
48
|
|
|
*/ |
49
|
|
|
protected function getEndpoint() { |
50
|
|
|
return 'ad_studies'; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return AdStudyFields |
55
|
|
|
*/ |
56
|
|
|
public static function getFieldsEnum() { |
57
|
|
|
return AdStudyFields::getInstance(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
protected static function getReferencedEnums() { |
61
|
|
|
$ref_enums = array(); |
62
|
|
|
$ref_enums['Type'] = AdStudyTypeValues::getInstance()->getValues(); |
63
|
|
|
return $ref_enums; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
|
67
|
|
|
public function createObjective(array $fields = array(), array $params = array(), $pending = false) { |
68
|
|
|
$this->assureId(); |
69
|
|
|
|
70
|
|
|
$param_types = array( |
71
|
|
|
'adspixels' => 'list<Object>', |
72
|
|
|
'applications' => 'list<Object>', |
73
|
|
|
'is_primary' => 'bool', |
74
|
|
|
'name' => 'string', |
75
|
|
|
'offlinefeeds' => 'list<Object>', |
76
|
|
|
'offsitepixels' => 'list<Object>', |
77
|
|
|
'type' => 'type_enum', |
78
|
|
|
); |
79
|
|
|
$enums = array( |
80
|
|
|
'type_enum' => AdStudyObjectiveTypeValues::getInstance()->getValues(), |
81
|
|
|
); |
82
|
|
|
|
83
|
|
|
$request = new ApiRequest( |
84
|
|
|
$this->api, |
85
|
|
|
$this->data['id'], |
86
|
|
|
RequestInterface::METHOD_POST, |
87
|
|
|
'/objectives', |
88
|
|
|
new AdStudyObjective(), |
89
|
|
|
'EDGE', |
90
|
|
|
AdStudyObjective::getFieldsEnum()->getValues(), |
91
|
|
|
new TypeChecker($param_types, $enums) |
92
|
|
|
); |
93
|
|
|
$request->addParams($params); |
94
|
|
|
$request->addFields($fields); |
95
|
|
|
return $pending ? $request : $request->execute(); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getSelf(array $fields = array(), array $params = array(), $pending = false) { |
99
|
|
|
$this->assureId(); |
100
|
|
|
|
101
|
|
|
$param_types = array( |
102
|
|
|
); |
103
|
|
|
$enums = array( |
104
|
|
|
); |
105
|
|
|
|
106
|
|
|
$request = new ApiRequest( |
107
|
|
|
$this->api, |
108
|
|
|
$this->data['id'], |
109
|
|
|
RequestInterface::METHOD_GET, |
110
|
|
|
'/', |
111
|
|
|
new AdStudy(), |
112
|
|
|
'NODE', |
113
|
|
|
AdStudy::getFieldsEnum()->getValues(), |
114
|
|
|
new TypeChecker($param_types, $enums) |
115
|
|
|
); |
116
|
|
|
$request->addParams($params); |
117
|
|
|
$request->addFields($fields); |
118
|
|
|
return $pending ? $request : $request->execute(); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
} |
122
|
|
|
|