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\ProductFeedFields; |
32
|
|
|
use FacebookAds\Object\Values\ProductFeedDelimiterValues; |
33
|
|
|
use FacebookAds\Object\Values\ProductFeedEncodingValues; |
34
|
|
|
use FacebookAds\Object\Values\ProductFeedQuotedFieldsModeValues; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* This class is auto-genereated. |
38
|
|
|
* |
39
|
|
|
* For any issues or feature requests related to this class, please let us know |
40
|
|
|
* on github and we'll fix in our codegen framework. We'll not be able to accept |
41
|
|
|
* pull request for this class. |
42
|
|
|
* |
43
|
|
|
*/ |
44
|
|
|
|
45
|
|
|
class ProductFeed extends AbstractCrudObject { |
46
|
|
|
|
47
|
|
|
protected function getEndpoint() { |
48
|
|
|
return 'product_feeds'; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return ProductFeedFields |
53
|
|
|
*/ |
54
|
|
|
public static function getFieldsEnum() { |
55
|
|
|
return ProductFeedFields::getInstance(); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
protected static function getReferencedEnums() { |
59
|
|
|
$ref_enums = array(); |
60
|
|
|
$ref_enums['Delimiter'] = ProductFeedDelimiterValues::getInstance()->getValues(); |
61
|
|
|
$ref_enums['Encoding'] = ProductFeedEncodingValues::getInstance()->getValues(); |
62
|
|
|
$ref_enums['QuotedFieldsMode'] = ProductFeedQuotedFieldsModeValues::getInstance()->getValues(); |
63
|
|
|
return $ref_enums; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
|
67
|
|
|
public function getProducts(array $fields = array(), array $params = array(), $pending = false) { |
68
|
|
|
$this->assureId(); |
69
|
|
|
|
70
|
|
|
$param_types = array( |
71
|
|
|
'bulk_pagination' => 'bool', |
72
|
|
|
'filter' => 'Object', |
73
|
|
|
); |
74
|
|
|
$enums = array( |
75
|
|
|
); |
76
|
|
|
|
77
|
|
|
$request = new ApiRequest( |
78
|
|
|
$this->api, |
79
|
|
|
$this->data['id'], |
80
|
|
|
RequestInterface::METHOD_GET, |
81
|
|
|
'/products', |
82
|
|
|
new ProductItem(), |
83
|
|
|
'EDGE', |
84
|
|
|
ProductItem::getFieldsEnum()->getValues(), |
85
|
|
|
new TypeChecker($param_types, $enums) |
86
|
|
|
); |
87
|
|
|
$request->addParams($params); |
88
|
|
|
$request->addFields($fields); |
89
|
|
|
return $pending ? $request : $request->execute(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function getUploads(array $fields = array(), array $params = array(), $pending = false) { |
93
|
|
|
$this->assureId(); |
94
|
|
|
|
95
|
|
|
$param_types = array( |
96
|
|
|
); |
97
|
|
|
$enums = array( |
98
|
|
|
); |
99
|
|
|
|
100
|
|
|
$request = new ApiRequest( |
101
|
|
|
$this->api, |
102
|
|
|
$this->data['id'], |
103
|
|
|
RequestInterface::METHOD_GET, |
104
|
|
|
'/uploads', |
105
|
|
|
new ProductFeedUpload(), |
106
|
|
|
'EDGE', |
107
|
|
|
ProductFeedUpload::getFieldsEnum()->getValues(), |
108
|
|
|
new TypeChecker($param_types, $enums) |
109
|
|
|
); |
110
|
|
|
$request->addParams($params); |
111
|
|
|
$request->addFields($fields); |
112
|
|
|
return $pending ? $request : $request->execute(); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function createUpload(array $fields = array(), array $params = array(), $pending = false) { |
116
|
|
|
$this->assureId(); |
117
|
|
|
|
118
|
|
|
$param_types = array( |
119
|
|
|
'file' => 'file', |
120
|
|
|
'password' => 'string', |
121
|
|
|
'update_only' => 'bool', |
122
|
|
|
'url' => 'string', |
123
|
|
|
'username' => 'string', |
124
|
|
|
); |
125
|
|
|
$enums = array( |
126
|
|
|
); |
127
|
|
|
|
128
|
|
|
$request = new ApiRequest( |
129
|
|
|
$this->api, |
130
|
|
|
$this->data['id'], |
131
|
|
|
RequestInterface::METHOD_POST, |
132
|
|
|
'/uploads', |
133
|
|
|
new ProductFeedUpload(), |
134
|
|
|
'EDGE', |
135
|
|
|
ProductFeedUpload::getFieldsEnum()->getValues(), |
136
|
|
|
new TypeChecker($param_types, $enums) |
137
|
|
|
); |
138
|
|
|
$request->addParams($params); |
139
|
|
|
$request->addFields($fields); |
140
|
|
|
return $pending ? $request : $request->execute(); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
public function deleteSelf(array $fields = array(), array $params = array(), $pending = false) { |
144
|
|
|
$this->assureId(); |
145
|
|
|
|
146
|
|
|
$param_types = array( |
147
|
|
|
); |
148
|
|
|
$enums = array( |
149
|
|
|
); |
150
|
|
|
|
151
|
|
|
$request = new ApiRequest( |
152
|
|
|
$this->api, |
153
|
|
|
$this->data['id'], |
154
|
|
|
RequestInterface::METHOD_DELETE, |
155
|
|
|
'/', |
156
|
|
|
new AbstractCrudObject(), |
157
|
|
|
'NODE', |
158
|
|
|
array(), |
159
|
|
|
new TypeChecker($param_types, $enums) |
160
|
|
|
); |
161
|
|
|
$request->addParams($params); |
162
|
|
|
$request->addFields($fields); |
163
|
|
|
return $pending ? $request : $request->execute(); |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
public function getSelf(array $fields = array(), array $params = array(), $pending = false) { |
167
|
|
|
$this->assureId(); |
168
|
|
|
|
169
|
|
|
$param_types = array( |
170
|
|
|
); |
171
|
|
|
$enums = array( |
172
|
|
|
); |
173
|
|
|
|
174
|
|
|
$request = new ApiRequest( |
175
|
|
|
$this->api, |
176
|
|
|
$this->data['id'], |
177
|
|
|
RequestInterface::METHOD_GET, |
178
|
|
|
'/', |
179
|
|
|
new ProductFeed(), |
180
|
|
|
'NODE', |
181
|
|
|
ProductFeed::getFieldsEnum()->getValues(), |
182
|
|
|
new TypeChecker($param_types, $enums) |
183
|
|
|
); |
184
|
|
|
$request->addParams($params); |
185
|
|
|
$request->addFields($fields); |
186
|
|
|
return $pending ? $request : $request->execute(); |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
public function updateSelf(array $fields = array(), array $params = array(), $pending = false) { |
190
|
|
|
$this->assureId(); |
191
|
|
|
|
192
|
|
|
$param_types = array( |
193
|
|
|
'default_currency' => 'string', |
194
|
|
|
'deletion_enabled' => 'bool', |
195
|
|
|
'delimiter' => 'delimiter_enum', |
196
|
|
|
'encoding' => 'encoding_enum', |
197
|
|
|
'name' => 'string', |
198
|
|
|
'quoted_fields' => 'bool', |
199
|
|
|
'schedule' => 'string', |
200
|
|
|
); |
201
|
|
|
$enums = array( |
202
|
|
|
'delimiter_enum' => ProductFeedDelimiterValues::getInstance()->getValues(), |
203
|
|
|
'encoding_enum' => ProductFeedEncodingValues::getInstance()->getValues(), |
204
|
|
|
); |
205
|
|
|
|
206
|
|
|
$request = new ApiRequest( |
207
|
|
|
$this->api, |
208
|
|
|
$this->data['id'], |
209
|
|
|
RequestInterface::METHOD_POST, |
210
|
|
|
'/', |
211
|
|
|
new ProductFeed(), |
212
|
|
|
'NODE', |
213
|
|
|
ProductFeed::getFieldsEnum()->getValues(), |
214
|
|
|
new TypeChecker($param_types, $enums) |
215
|
|
|
); |
216
|
|
|
$request->addParams($params); |
217
|
|
|
$request->addFields($fields); |
218
|
|
|
return $pending ? $request : $request->execute(); |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
} |
222
|
|
|
|